Questions tagged [hashing]

A hash function is any algorithm that maps data of arbitrary length to data of a fixed length. The values returned by a hash function are called hash values, hash codes, hash sums, checksums or simply hashes. From Wikipedia: http://en.wikipedia.org/wiki/Hash_function

A hash function is any algorithm that maps data of arbitrary length to data of a fixed length. The values returned by a hash function are called hash values, hash codes, hash sums, checksums or simply hashes. Recent development of internet payment networks also uses a form of 'hashing' for checksums, and has brought additional attention to the term.

From wikipedia: hash function

163 questions
1635
votes
11 answers

Which hashing algorithm is best for uniqueness and speed?

Which hashing algorithm is best for uniqueness and speed? Example (good) uses include hash dictionaries. I know there are things like SHA-256 and such, but these algorithms are designed to be secure, which usually means they are slower than…
Earlz
  • 22,658
  • 7
  • 46
  • 60
142
votes
3 answers

Where do "magic" hashing constants like 0x9e3779b9 and 0x9e3779b1 come from?

In code dealing with hash tables, I often find the constant 0x9e3779b9 or sometimes 0x9e3779b1. For example hash = n * 0x9e3779b1 >>> 24 Why is this particular value used?
bkgs
  • 1,003
  • 2
  • 6
  • 5
77
votes
2 answers

Why do so many hashed and encrypted strings end in an equals sign?

I work in C# and MSSQL and as you'd expect I store my passwords salted and hashed. When I look at the hash stored in an nvarchar column (for example the out the box aspnet membership provider). I've always been curious why the generated Salt and…
Liath
  • 3,406
  • 1
  • 21
  • 33
53
votes
4 answers

What is the difference between a hash and a dictionary?

What is the difference between Hash and Dictionary? Coming from a scripting background, I feel that they are similar, but I wanted to find out the exact differences. Googling did not help me much.
Sairam
  • 641
  • 1
  • 5
  • 8
50
votes
8 answers

Why almost no webpages hash passwords in the client before submitting (and hashing them again on the server), as to "protect" against password reuse?

There are many sites on the Internet that require login information, and the only way to protect against password reusing is the "promise" that the passwords are hashed on the server, which is not always true. So I wonder, how hard is to make a…
44
votes
6 answers

Is it more secure to hash a password multiple times?

I've read a few times that when storing passwords, it's good practice to 'double hash' the strings (eg. with md5 then sha1, both with salts, obviously). I guess the first question is, "is this actually correct?" If not, then please, dismiss the rest…
Narcissus
  • 667
  • 1
  • 5
  • 9
26
votes
3 answers

I'm trying to understand hash tables - can someone explain it to me - clearly?

I want to understand the correct use and implementation of hash tables in php (sorry). I read somewhere that an in-experienced programmer created a hash table and then iterated through it. Now, I understand why that is wrong but I haven't quite got…
Stevo
  • 453
  • 1
  • 5
  • 7
26
votes
4 answers

Why is the Git .git/objects/ folder subdivided in many SHA-prefix folders?

Git internally stores objects (Blobs, trees) in the .git/objects/ folder. Each object can be referenced by a SHA1 hash that is computed from the contents of the object. However, Objects are not stored inside the .git/objects/ folder directly.…
Qqwy
  • 4,709
  • 4
  • 31
  • 45
19
votes
6 answers

What makes a hashing algorithm "secure"?

After reading this interesting question, I felt like I had a good idea of which insecure hashing algorithm I'd use if I needed one, but no idea why I might use a secure algorithm instead. So what is the distinction? Isn't the output just a random…
CodexArcanum
  • 3,421
  • 21
  • 23
16
votes
6 answers

How to implement float hashing with approximate equality

Let's say we have the following Python class (the problem exists in Java just the same with equals and hashCode) class Temperature: def __init__(self, degrees): self.degrees = degrees where degrees is the temperature in Kelvin as a…
Marten
  • 269
  • 2
  • 6
15
votes
6 answers

How to assure users that website and passwords are secure

On reliable websites I always see claims such as "All data is encrypted" or "All passwords are encrypted using 128bit encryption" and etc. However I have never come across a claim such as "All passwords are hashed." On my website, I will be storing…
user2698818
  • 151
  • 3
15
votes
3 answers

How do scalable bloom filters work?

I was reading up on scalable bloom filters and could not understand how each time a constituent bloom filters fills up, a new bloom filter with larger size is added. The elements that contributed to the set bits in the initially created filters…
user434345
  • 269
  • 2
  • 4
12
votes
6 answers

Where should salt hash values come from?

When adding salt values to a hash value for something like a password that cannot be stored in plain text, what is the best place to get the salt values come from? For context, let us suppose this is for passwords on a webpage login.
Morgan Herlocker
  • 12,722
  • 8
  • 47
  • 78
12
votes
3 answers

Is it possible to implement a well-distributed hash table without using the % operator?

I'm looking to implement a fast, well-distributed hash table in C#. I'm having trouble choosing my hash-constraining function that takes an arbitrary hash code and "constrains" it so it can be used to index the buckets. There are two options that I…
James Ko
  • 358
  • 4
  • 13
12
votes
2 answers

Is it possible to speed up a hash table by using binary search trees for separate chaining?

I want to implement a Hash Table using Binary Search Trees to reduce the search complexity in the Separate Chaining process from O(n) (using linked list) to O(log n) (using BST). Can this be done, and if yes then how? It would be easier to…
Aviral
  • 139
  • 1
  • 1
  • 5
1
2 3
10 11