views:

39

answers:

2

how would you use, say, the string "abc" as the seed of an rng? would you change it into 0x616263, or 123, or hash it with sha1 (or some other hash), or something else?

A: 

Hashing with a high-quality hashing algorithm seems like the best solution. However, depending on how many bits you have to seed with, you might have to use only a part of the generated hash. This shouldn't be a problem if you use a cryptographically strong algorithm that has well-distributed outputs.

Mike Daniels
Why was this downvoted? Am I missing something?
Gabe
A: 

I'm assuming

  • you want a repeatable pseudorandom sequence
  • your RNG expects an integer.

In this case, the answer is: it doesn't matter.

egrunin