message-digest

c# fast hash calculation

Hi, I'm looking for a c# wrapper to a native MD5 or SHA1 library to improve hash calculation performance. Previously I switched SharpZipLib to zlib and got more than 2x performance boost. (ok, you've to take care you've the right zlib.so or zlib.dll depending on the OS and hardware, but it pays off). Will it be worth for MD5 or SHA1 o...

Verifying file digests

Say I have 'n' number of files, for each of which I have CRC32, MD5 and SHA1 digests Now these 'n' number of files are actually split files/archives of single large file. When these smaller files are recombined/joined into the larger file, we can compute the digest of this larger file too. My question is : Is there a way to verify whe...

When is it safe to use a broken hash function?

It is trivial to use a secure hash function like SHA256 and continuing to use md5 for security is reckless behavior. However, there are some complexities to hash function vulnerabilities that I would like to better understand. Collisions have been generated for md4 and md5. According to NIST md5() is not a secure hash function. It ...

construct a unique number for a string in java

We have a requirement of reading/writing more than 10 million strings into a file. Also we do not want duplicates in the file. Since the strings would be flushed to a file as soon as they are read we are not maintaining it in memory. We cannot use hashcode because of collisions in the hash code due to which we might miss a string as dup...

How to set MessageDigest seed?

The MessageDigest class implements the SHA-1 algorithm (among many others). The SHA-1 algorithm allows one to use different "seeds" or initial digests. See SHA-1 Psuedocode The algorithm initializes variables, or the seed: Initialize variables: h0 = 0x67452301 h1 = 0xEFCDAB89 h2 = 0x98BADCFE h3 = 0x10325476 h4 = 0xC3D2E1F0 Howev...