Kind of a noob question. Suppose;

  1. We generate 1,000 cryptographic-ally secure random numbers & store each of them in an array1.
  2. For each number in this array1, we take the hash sha256(CSRN) then store the digests in array2

For simplicity, lest say array2 has 3 digests,

array2 = [a22110a41f165b6b0f3cc053b50214b284add1b0f8628f78c7522906c8f78da0, d160c64b851dfa1606283ce84799c83c237e0cebfc8e210eb2eaf5ba24f845cb, 35bf775fe6ff7c97520d76665059e21023d9f8de094a3b6c351143241cc7649b]

My question is, if I concatenate the items in array to to form a longer hex such as;

longhex = a22110a41f165b6b0f3cc053b50214b284add1b0f8628f78c7522906c8f78da0d160c64b851dfa1606283ce84799c83c237e0cebfc8e210eb2eaf5ba24f845cb 35bf775fe6ff7c97520d76665059e21023d9f8de094a3b6c351143241cc7649b

Is longhex also considered a CSRN?


Yes it most certainly is, on the assumption that the hashing algorithm used is cryptographically secure and uniform in its output.

As a thought experiment, consider that after Elliptic Curve Diffie Hellman, the shared secret's (curve point) x co-ordinate is recommended by good practice to be passed through a hashing algorithm to derive a key.

This is because the shared secret, whilst a random element of the curve generators cyclic subgroup, may not be uniform key material.

Thus, we can trust that good hashing algorithm's will not erode the underlying entropy of an input (beyond truncation), and should provide uniform output.

Thus I would deduce that concatenated hashes of cryptographically secure input should result in a cryptographically secure output of equal entropy to the input (assuming the hash output length is approximately equal to the CSRN input length).

  • $\begingroup$ Thanks for the very detailed experiment. Another question, does the truncation reduce entropy in any meaningful way? $\endgroup$
    – M4X_
    Jan 9 '20 at 16:19
  • $\begingroup$ @M4X_ sorry for the delayed reply friend. So, truncation works like this... say you have a 1024 bit key (with known good 1024bit entropy), and run it through a good cryptographic hash function like SHA-512, you would then have an output that has 512bit entropy, despite the higher entropy input, so if your CSRN's have large entropy sets, you should try and choose a higher output hash function. (Happy if any of the other folks want to contradict me here, however I believe this is correct) $\endgroup$
    – Woodstock
    Jan 9 '20 at 18:21
  • 1
    $\begingroup$ Thanks. You were really helpful $\endgroup$
    – M4X_
    Jan 9 '20 at 18: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.