Thursday, August 2, 2012

SecureRandom

SecureRandom class is the facade class to issue base64, uuid and so forth.
[1] pry(main)> require 'securerandom'
=> true
[2] pry(main)> SecureRandom.hex
=> "444adf4fe82c00ab6d9a7cdffc6d46e1"
[3] pry(main)> SecureRandom.base64
=> "B4hdEsaM3icerGi2/LIEFw=="
[4] pry(main)> SecureRandom.urlsafe_base64
=> "--gOBG02VkWhimQz-6mVyA"
[5] pry(main)> SecureRandom.uuid
=> "da3488c8-0aca-45d0-bd60-d2d1a1df1a02"

No comments:

Post a Comment