What is the difference between using MD5.Create and MD5CryptoServiceProvider?

System.Security.Cryptography.MD5.Create() is actually creating a MD5CryptoServiceProvider. That is why you see the same results. Looking at the definition MD5 is the base class and it’s abstract. I’m guessing they added the public create function for ease of use. public sealed class MD5CryptoServiceProvider : MD5 { } public abstract class MD5 : HashAlgorithm { } Take … Read more

What is a best practice of writing hash function in java?

Here’s a quote from Effective Java 2nd Edition, Item 9: “Always override hashCode when you override equals“: While the recipe in this item yields reasonably good hash functions, it does not yield state-of-the-art hash functions, nor do Java platform libraries provide such hash functions as of release 1.6. Writing such hash functions is a research … Read more

Hashing passwords with MD5 or sha-256 C#

Don’t use a simple hash, or even a salted hash. Use some sort of key-strengthening technique like bcrypt (with a .NET implementation here) or PBKDF2 (with a built-in implementation). Here’s an example using PBKDF2. To generate a key from your password… string password = GetPasswordFromUserInput(); // specify that we want to randomly generate a 20-byte … Read more

Instant login from email. Why have so few done this?

On some sites you can separate the “important stuff” from the “really, really important stuff”. Let’s say that the “important stuff” on your site allows users to view policies, active members and incoming group messages. The “really, really important stuff” allows you to change policies, reset passwords and add new users. So what you can … Read more

A good hash function for a vector

So, when not wanting to use boost, Michael Blurr’s comment led to the following hash function implementation: std::size_t operator()(std::vector<uint32_t> const& vec) const { std::size_t seed = vec.size(); for(auto& i : vec) { seed ^= i + 0x9e3779b9 + (seed << 6) + (seed >> 2); } return seed; } Seems to work. Edit: see’s answer … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)