All Questions

67
votes
2answers
3433 views

Cleansing User Passwords

How should I escape or cleanse user-provided passwords before I hash them and store them in my database? When PHP developers consider hashing users' passwords for security purposes, they often tend t...
985
votes
14answers
177652 views

Secure hash and salt for PHP passwords

It is currently said that MD5 is partially unsafe. Taking this into consideration, I'd like to know which mechanism to use for password protection. This question, Is “double hashing” a password l...
418
votes
11answers
163720 views

Fundamental difference between Hashing and Encryption algorithms

I see a lot of confusion between hashes and encryption algorithms and I would like to hear some more expert advice about: When to use hashes vs encryptions What makes a hash or encryption algorithm ...
198
votes
23answers
315263 views

Is it possible to decrypt md5 hashes?

Someone told me that he has seen software systems that would accept MD5 encrypted passwords (through various integrations with other systems), decrypt them, and store them in the systems own database ...
837
votes
31answers
850940 views

How can I generate an MD5 hash?

Is there any method to generate MD5 hash of a string in Java?
80
votes
5answers
15851 views

Strange, unexpected behavior (disappearing/changing values) when using Hash default value, e.g. Hash.new([])

Consider this code: h = Hash.new(0) # New hash pairs will by default have 0 as values h[1] += 1 #=> {1=>1} h[2] += 2 #=> {2=>2} That’s all fine, but: h = Hash.new([]) # Empty arr...
103
votes
5answers
14991 views

Is there any difference between the `:key => "value"` and `key: "value"` hash notations?

Is there any difference between :key => "value" (hashrocket) and key: "value" (Ruby 1.9) notations? If not, then I would like to use key: "value" notation. Is there a gem that helps me to convert ...
366
votes
10answers
108716 views

Why does Java's hashCode() in String use 31 as a multiplier?

In Java, the hash code for a String object is computed as s[0]*31^(n-1) + s[1]*31^(n-2) + ... + s[n-1] using int arithmetic, where s[i] is the ith character of the string, n is the length of the str...
236
votes
20answers
187237 views

Best implementation for hashCode method

How do we decide on the best implementation of hashCode() method for a collection (assuming that equals method has been overridden correctly) ?
176
votes
1answers
136584 views

C++ unordered_map using a custom class type as the key

I am trying to use a custom class as key for unordered_map, like the following, #include <iostream> #include <algorithm> #include <unordered_map> //#include <map> using names...

Previous Next