0

Is this done using cryptographic hashing, or just with a sum of the ASCII codes?

A possible use case would be on a video game with random procedural generation, where the game allows users to enter a random seed manually.

1 Answers1

0

Cryptographic functions generally require bits as input. So usually the seed can be mixed in using a function call that takes a byte array. Sometimes you see functions that take a 64 bit or 32 bit "word" but that's uncommon for cryptography where at least 128 bits of entropy is required (you can add any amount of entropy at the time of course, but in the end you will want your output to rely on at least 128 bits of entropy. For CSPRNG's the seed parameters generally don't need to be prehashed.

So the only thing you need to do is to represent the data containing the entropy to have a (preferably canonical) binary representation. For a string consisting of "ASCII codes" you could just encode the text as ASCII and feed it into the CSPRNG. The "hashing" is normally performed by the RNG.

Beware that a random number generator is generally not designed to always produce the same output for a specific seed. The algorithm may be deterministic, but the implementation of specific function that act on the random output often are not, at least between different versions of the RNG. If that kind of functionality is required you might be better off using a specific implementation within your application (e.g. a stream cipher).

Maarten Bodewes
  • 96,351
  • 14
  • 169
  • 323