dimanche 30 août 2015

Ruby generate random string from key

What's the best way to create a random string given a key. For example, I am using this

(0...50).map { ('a'..'z').to_a[rand(26)] }.join

But, I want the alphanumeric string that is generated based on a string such as "mysecretkey". I don't want to use encryption gems or Cipher, etc. I want to keep it simple like what I have, but adding a key to it.




Aucun commentaire:

Enregistrer un commentaire