0

I've seen some answers here talk about truncating a sha hash... does that also mean that the individual bytes/words are random relative to each other?

TLDR
  • 700
  • 1
  • 7
  • 17
  • can you explain what you mean with *"random relative to each other"* ? If you mean that you cannot predict or narrow down a byte just by knowing the other bytes then yes, this is the case. – Steffen Ullrich May 08 '17 at 04:37
  • Related question: https://crypto.stackexchange.com/questions/40268/hash-functions-and-the-avalanche-effect – Lekensteyn May 08 '17 at 08:22

1 Answers1

3

Well, if SHA-256 hashing exposed non-random patterns in the resulting byte sequence, that would indicate a remarkable design flaw. No such flaws are publicly known which is why truncating a SHA-256 hash is fine (as long as you consider that you end up with a shorter hash, of course).

That said, cryptographic hash functions are no random oracles and you should still be careful when using one as a PRNG.

Arminius
  • 43,922
  • 13
  • 140
  • 136
  • If an attacker can somehow guess the input of the hash then the output of the bytes are obviously linked to the other by the hash function itself (which itself should not be considered a secret). So a small reminder: this is only the case if the input of the hash cannot be guessed or verified with any certainty. – Maarten Bodewes May 08 '17 at 17:02