2

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?

Snesrod
  • 23
  • 3

1 Answers1

1

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
Maarten Bodewes
  • 96,351
  • 14
  • 169
  • 323