2
$\begingroup$

I was wondering how can I use NIST Statistical Test Suite to check for the randomness of output generated by a cryptographic hashing algorithm, let say SHA-256?

To be specific, how will I generate input for the suite? For block ciphers, we use key avalanche, plaintext and ciphertext avalanche, etc as inputs of the suite. Is same kind of inputs are used while evaluating a cryptographic hash algorithm, as for an S-box or block cipher?

$\endgroup$

migrated from security.stackexchange.com Aug 20 at 7:37

This question came from our site for information security professionals.

  • 2
    $\begingroup$ Do you have any particular reason to use randomness testing? It can only detect certain obvious failure cases, but can not prove security. $\endgroup$ – Natanael Aug 20 at 9:32
  • $\begingroup$ besides cryptanalysis, i know only statistical tests through which a cryptographic algorithm can be analyzed. No, i am not doing this for some particular use but for general reseatch as how different cryptographic hash algos can be evaluated. $\endgroup$ – Raeesa Aug 20 at 10:17
  • $\begingroup$ modern cryptographic algorithms are typically meant to be indistinguishable from random. You won't learn anything more than just that, they will all look like their outputs are random. You'd learn more from looking at known broken algorithms and comparing them to strong ones, to see what the difference is. $\endgroup$ – Natanael Aug 20 at 12:48
  • $\begingroup$ You won't be checking SHA-256. You'll be checking your software, how you use the NIST Statistical Test Suite, and that suite. $\endgroup$ – fgrieu Aug 20 at 17:12
  • $\begingroup$ Thankyou all.The purpose of using NIST STS is not to check for randomness only but, in my case, other characteristics aswell such as uniform distribution to avoid birthday and other similar attacks related to collisions. For this i wanted to use few statistical tests such as chi-square and K-S test. Are there other means or test recommended for quick tests/compare different cryptographic hashing algorithms(SHA256, RIPEMD, Whirlppol) . $\endgroup$ – Raeesa Aug 21 at 4:55
3
$\begingroup$

You simply create a hashed counter. So output = SHA-256(n) whilst incrementing n. You'd make n a large multi-byte variable, say 16 bytes, and seed it at a random value from some PRNG you find lying around. That way you can perform repeat runs to generate different sequences. I find that you need >10MB for some of the template tests to complete fully.

I won't bother repeating Natanael's comment to you :-)

$\endgroup$
  • $\begingroup$ maybe i am not able to make my question clear. Randomness of a Cryptographic Hash function is very important and a first step to do cryptaalysis.. i came across SHAVS of NIST. this helps us for behavioral analysis if a cryptp primitive. $\endgroup$ – Raeesa Aug 31 at 4:08
  • $\begingroup$ @Raeesa Okay, but I'm not quite sure what you're driving at then. I thought that you were focusing on stuff like SHAVS section 6.4 which does it Monte Carlo fashion. That's fundamentally what the NIST test suite does, comparing hash output with expectation. Have I misunderstood? $\endgroup$ – Paul Uszak Sep 4 at 1:20
1
$\begingroup$

Crypto randomness tests are suggested by Ali in his paper while validating SHA-3. His team also used NIST for randomness testing. For more infor: https://eprint.iacr.org/2010/611.pdf

Thankyou everyone!

$\endgroup$

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.