Just beginning in a picture, add Chinese or punctuation, and then get the hash value to verify whether the picture is generated from your own system, but find a problem in which the hash value of the picture is not what you changed in the picture it will change, it needs to change to a certain extent before it changes, And the transparency cannot be 0.0f, if just want to play in the picture of a mark that you know, not to show to others to see, with the hash of the judge is unable to judge the picture, and then looked up some data, try to get the picture of MD5, after trying to find this can replace the hash value to judge the picture, And this will not change because the amount of markup is small, or the transparency is 0.0f, the code is as follows:
Use the following method to get the MD5 of the file, and then use this to determine if you are marking the picture.
public static String getFileMD5 (file file) {
//To determine if there is a file
if (!file.isfile ()) {return
null;
}
Create a digest algorithm object
messagedigest digest = null;
FileInputStream In=null;
byte buffer[] = new byte[1024];
int Len;
try {
digest = messagedigest.getinstance ("MD5");
in = new FileInputStream (file);
while (len = in.read (buffer, 0, 1024))!=-1) {
digest.update (buffer, 0, Len);
}
In.close ();
} catch (Exception e) {
e.printstacktrace ();
return null;
}
BigInteger bigInt = new BigInteger (1, Digest.digest ());
return bigint.tostring ();