0
$\begingroup$

If a hash function like Whirlpool or Sha512 would take a byte array of 1 MB in size filled with the output of a Secure RNG as its input message, would this be considered a strong input message, a strong key, or neither ?

$\endgroup$
  • 1
    $\begingroup$ What are you actually trying to do? $\endgroup$ – Squeamish Ossifrage Nov 3 '17 at 17:58
  • $\begingroup$ I want to learn more about hash functions. For what it's worth, im trying to come up with a quick but secure way to generate random passwords and im starting out by fully coming to understand the input message size bit. $\endgroup$ – user92306 Nov 3 '17 at 18:06
  • 1
    $\begingroup$ If you have a secure RNG, you can use that to pick indices into an array of words to select a sequence of words for a passphrase. For $d$ words in your dictionary, pick $n$ so that $d^n > 2^{128}$, and you'll have a good passphrase generator. E.g., for $d = 2000$, a twelve-word passphrase is a good size. If the RNG produces bits, use rejection sampling to avoid modulo bias. The secure RNG itself might be built out of SHA-512 (probably not Whirlpool, which is not widely used), but you don't need to feed the RNG output through it afterward. $\endgroup$ – Squeamish Ossifrage Nov 3 '17 at 22:09
0
$\begingroup$

To answer the motivating question that the original poster asked in a comment:

If you have a secure RNG, you can use that to pick indices into an array of words to select a sequence of words for a passphrase. For $d$ words in your dictionary, pick $n$ words so that $d^n > 2^{128}$, and you'll have a good passphrase generator. E.g., for $d = 2000$ (say, a dictionary of two thousand common memorable and pairwise distinct French words), a twelve-word passphrase is a good size. If the RNG produces bits rather than integers, use rejection sampling to avoid modulo bias. The secure RNG itself might be built out of SHA-512 (probably not Whirlpool, which is not widely used), but you don't need to feed the RNG output through it afterward.

$\endgroup$
  • $\begingroup$ Thank you for the great reply! Especially for the modulo bias bit, that was news to me all together. $\endgroup$ – user92306 Nov 4 '17 at 12:45
0
$\begingroup$

Neither.

There is no such a thing as a strong input message to a secure hash function.

Hash functions don't take a key as input. Keys could be used as input to a KBKDF such as HKDF to derive additional keys key secrets. Those algorithms are often build from hashes though.

The output of a secure random bit generator doesn't need to be hashed to be secure. Many PRNGs / DRBGs are actually build from secure hash functions. Adding a single hash won't help.

$\endgroup$
  • $\begingroup$ Let me put this in a different light: If I want to make cryptanalysis on my final product K as hard as possible, and K is constructed from an input message to which additional entropy to the product is added by way of the SRNG's involvement, could K then be considered a secure hash product (i.e. hard to crack) then ? I know this sounds strange, but there you go. $\endgroup$ – user92306 Nov 4 '17 at 13:25
  • $\begingroup$ on a side-note, I know that hash functions by themselves don't take keys as an input. My question was mostly if the size of the input message that is fed to the hash function is of great significance to an attacker; does a bigger and more complex input message really create a significant difference for the end resulting complexity of the final product of this function ? $\endgroup$ – user92306 Nov 4 '17 at 13:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.