2
$\begingroup$

Let's say we generate a sentence in a way like for example this: Fix an initial seed. Attach '1' at the end of the seed and compute sha256 of such a string. This hash is our first number. Now attach 2 at the end of the seed(instead of 1 like in the previous step) and compute sha256 to get our 2nd number. And so on.

Will this sequence behave randomly? Would it be possible to extract any information about the inital seed if enough numbers of the generated sequence are known? Does anything in this matter change if we decrease the size of the generated numbers by, for example, truncating the hash to a couple of the initial bytes or taking the hash modulo a very small number?

$\endgroup$
2
  • 1
    $\begingroup$ This sounds extremely similar to crypto.stackexchange.com/questions/33867/… $\endgroup$ Mar 21 '16 at 23:33
  • $\begingroup$ Not only is it difficult to compute the initial seed, I believe that this is actually a secure stream cipher. $\endgroup$
    – Demi
    Mar 22 '16 at 2:30
1
$\begingroup$

This is basically how KDF1 and KDF2 work: use a secret, add a (constant sized) label + possible other values such as a salt and then use this as input for a hash value.

Another way to look at it is to view the seed + number as a new number and then reduce the problem to the problem that Richie Frame pointed at.

So:

  1. yes it will behave randomly
  2. no, no information about the seed can be retrieved
  3. truncation of hashes is a well known method, and will not leak any more information
$\endgroup$
1
  • $\begingroup$ It would be rather strange if removing data would generate more information. There must be some kind of law against that. $\endgroup$
    – Maarten Bodewes
    Mar 21 '16 at 23:44

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.