I am trying to create a unique name for each file you upload to my server from my Jar. I am using the MessageDigest
MD5 class to create, but unfortunately I always get the same name.
BufferedImage buffImg = ImageIO.read(imageEntry);
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
ImageIO.write(buffImg, Utils.getExtensionNoDot(imageEntry.getName()), outputStream);
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(outputStream.toByteArray());
BigInteger bigInt = new BigInteger(1,md.digest());
String md5 = bigInt.toString(16);
My md5 is the same as always, through print and verify the results, I know my MessageDigest is always different, but the result is always the same BigInt.