Questions tagged [hash]

A cryptographic hash algorithm is a function which takes a variable size input and produces a fixed size output. The algorithm makes it difficult to find two inputs with the same output or reconstruct the input from the output.

A cryptographic hash algorithm, also called a cryptographic hash function, is a function which takes a variable size input and produces a fixed size output.

As of 2012, the biggest news in cryptographic hash algorithms is the ongoing NIST hash function competition for .

People who design hash algorithms attempt to make it difficult to predict the output for a given input, find two inputs with the same output (a ), or reconstruct the input from the output.

Alas, some popular hash algorithms are not as good at this as their designer had hoped.

Many diverse sub-fields in cryptography use cryptographic hash algorithms:

A particular output value generated by such an algorithm is given various names in various contexts: the cryptographic hash, the hash value, the message digest, the digital fingerprint, etc.

  • and its predecessor use for message authentication, which in turn uses the (fast) cryptographic hash .
  • validation usually uses a deliberately-slow cryptographic hash for password hashing (sometimes misleadingly called "password encryption"), such as , , or .
  • Most high-quality hardware random number generators use a cryptographic hash to "whiten" the raw data sample measurements
  • etc.

Wikipedia: cryptographic hash function

2992 questions
31
votes
3 answers

Is every output of a hash function possible?

Is every output of a hash function (e.g. SHA1, MD5, etc) guaranteed to be possible, or, conversely, are there any output values that cannot possibly be created from any input? In other words, are hash functions surjective? If so, what guarantees…
Polynomial
  • 3,527
  • 4
  • 29
  • 45
21
votes
5 answers

Hash function that allows to decide if A > B if you only have hash(A) and hash(B)?

Is it possible to construct a hash function with the following property? If you have hash(A) and hash(B) with A and B being integers, you can tell if A is greater than B -- without however knowing the actual values of A and B. Even better: If you…
RudolfKaiser
  • 373
  • 2
  • 5
16
votes
2 answers

Difference between "one-way function" and "cryptographic hash function"

What's the difference between a one-way function and a cryptographic hash function?
juaninf
  • 2,701
  • 2
  • 18
  • 28
16
votes
2 answers

Is digest=HASH(HASH(a)+HASH(b)) equivalent to publishing two digests?

Is combining digests (created using a hash function) using arithmetic addition, and then hashing and publishing the result, less secure than publishing the set of digests? Does the answer change if the outer hash function is different from the inner…
gavinandresen
  • 263
  • 1
  • 6
15
votes
2 answers

Provably fair card deck used by client and server

Say a server plays a game of blackjack with a client, and the cards are shuffled and dealt by the server. The shuffle itself may or may not be fair, but what needs to be shown is that the cards dealt weren't altered during the course of gameplay,…
user4779
  • 253
  • 2
  • 5
14
votes
4 answers

Do parts of a hash carry the properties of the entire hash?

When I need to generate unique id's based on some information hashing is typical choice. However, sometimes that id needs to be of a particular size. I've seen a lot of schemes (HMAC-MD5-96 in SSH, CGA in SeND for IPv6) that use a portion of a…
Marcin
  • 263
  • 1
  • 6
14
votes
2 answers

Difference between salted hash and keyed hashing?

A cryptographic salt is additional input other than message itself for a hash function so that it prevents attacker from launching dictionary attacks . Usually the salt is stored along with the hash of say the password etc. Keyed Hashing is secret…
sashank
  • 6,174
  • 4
  • 32
  • 67
13
votes
3 answers

Computing only one byte of a cryptographically secure hash function

Let $H$ be a cryptographically secure hash function, like SHA256. The output of $H$ is $N$ bytes long, with $N$ usually in the order of $32$ for commonly used hash functions. Now, be $X$ a string, I can compute $Y = H(X)$, which is a sequence $Y_0,…
Matteo Monti
  • 1,407
  • 2
  • 14
  • 19
13
votes
1 answer

How does Truecrypt change password without the need for a complete re-encryption of volume

From what I understand: TrueCrypt takes the password as message Add salt calculates a digest use digest for encryption From what I understand. A good hash function has Second pre-image resistance .i.e. It is difficult to find $m_2$ such that…
aiao
  • 233
  • 1
  • 2
  • 5
12
votes
4 answers

Best way to hash two values into one?

I'm trying to hash two unique strings together to create a hash. The most obvious way would be simply to concatenate the two and run a hash function on it: hash = sha256(strA + strB) But I was wondering if this is how most people do it, and if…
Vlad
  • 569
  • 1
  • 4
  • 12
12
votes
2 answers

Distribution of hash values

I was wondering if the uniform distribution of hash values is a generally required criteria for cryptographic hash functions. The english wikipedia article only mentions four main properties. But it looks like the commonly used algorithms show a…
masinger
  • 463
  • 4
  • 9
12
votes
2 answers

Will repeated rounds of SHA-512 provide random numbers?

If I hash a keyword with SHA-512 and then feed the output as the key for the next round ....and keep repeating this process, will I gather a stream of random numbers?
user2256790
  • 433
  • 4
  • 12
11
votes
3 answers

Smallest Guaranteed hash collision cycle length

If I take the sha-256 of an empty string, and apply the hash function $2^{256}!$ times, will I end up with the same hash that I started with? Is the smallest required cycle equal to the LCM of $1$ to $2^{256}$?
William
  • 235
  • 1
  • 6
11
votes
3 answers

Associative standard cryptographic hash function

I am looking for a standard hash function which satisfies the following property: A hash function $H(a,b) = F(h(a),h(b))$ with $h$ (within $F$) any standard cryptographic hash function and $F$ an associative function. Is there any standard hash…
10
votes
1 answer

How to reverse x XOR (x >>> 1) XOR (x >>> 2)

Short version: What is the inversion of $f(x) = x \oplus (x \lll 1) \oplus (x \lll 5)$ when the last 4 bits of $x$ are known? Long version: Hi, a friend a mine and I are giving each other crypto challenges to break. This time, he gave me a "one-way"…
VincBreaker
  • 1,484
  • 11
  • 25
1
2 3
17 18