Is the ActiveSupport::SecureRandom
secure in the way that it is 'impossible' to figure out random numbers or is it secure in the way that it will return UUIDs?
Secure random number generator interface. This library is an interface to secure random number generators which are suitable for generating session keys in HTTP cookies, etc. You can use this library in your application by requiring it: require 'securerandom'
SecureRandom. hex generates a random hexadecimal string. The argument n specifies the length, in bytes, of the random number to be generated. The length of the resulting hexadecimal string is twice n. If n is not specified or is nil, 16 is assumed.
The security of the random number (and its application) comes from how sufficiently random it is for cryptographic purposes. The quality of the randomness relies to a great extent on the entropy that the system can provide such as through interfaces like /dev/urandom
on Linux. For it to be secure, an attacker must not be able to guess the next random number, given some sequence of previously generated random numbers.
You could use ActiveRecord::SecureRandom as part of an implementation for creating UUID (version 4) but they are not directly related
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With