SHA-256 or MD5 for file integrity

Both SHA256 and MDA5 are hashing algorithms. They take your input data, in this case your file, and output a 256/128-bit number. This number is a checksum. There is no encryption taking place because an infinite number of inputs can result in the same hash value, although in reality collisions are rare. SHA256 takes somewhat … Read more

How can I get the MD5 fingerprint from Java’s keytool, not only SHA-1?

With JDK 1.7 installed, keytool always outputs by default SHA1 fingerprint, not MD5. you can get the MD5 Certificate by adding -v option. use the following code:- C:\Program Files\Java\jdk1.7.0\bin>keytool -v -list -alias androiddebugkey -keystore debug.keystore -storepass android -keypass android it will output MD5 certificate as well.

Is there an MD5 Fixed Point where md5(x) == x?

Since an MD5 sum is 128 bits long, any fixed point would necessarily also have to be 128 bits long. Assuming that the MD5 sum of any string is uniformly distributed over all possible sums, then the probability that any given 128-bit string is a fixed point is 1/2128. Thus, the probability that no 128-bit … Read more

MD5 algorithm in Objective-C

md5 is available on the iPhone and can be added as an addition for ie NSString and NSData like below. MyAdditions.h @interface NSString (MyAdditions) – (NSString *)md5; @end @interface NSData (MyAdditions) – (NSString*)md5; @end MyAdditions.m #import “MyAdditions.h” #import <CommonCrypto/CommonDigest.h> // Need to import for CC_MD5 access @implementation NSString (MyAdditions) – (NSString *)md5 { const char … Read more

Random hash in Python

A md5-hash is just a 128-bit value, so if you want a random one: import random hash = random.getrandbits(128) print(“hash value: %032x” % hash) I don’t really see the point, though. Maybe you should elaborate why you need this…

PHP best way to MD5 multi-dimensional array?

(Copy-n-paste-able function at the bottom) As mentioned prior, the following will work. md5(serialize($array)); However, it’s worth noting that (ironically) json_encode performs noticeably faster: md5(json_encode($array)); In fact, the speed increase is two-fold here as (1) json_encode alone performs faster than serialize, and (2) json_encode produces a smaller string and therefore less for md5 to handle. Edit: … Read more