equivalent / public_uid

Automatically generates random unique public id for record.
MIT License
76 stars 8 forks source link

string generator should use SecureRandom.hex for consistancy #10

Closed equivalent closed 5 years ago

equivalent commented 8 years ago

currently the string generator is custom built solution https://github.com/equivalent/public_uid/blob/master/lib/public_uid/generators/range_string.rb`

For consistency let's keep that generator as it is.

But it would be nice if we create standardize SecureRandom generator that will be the default one, e.g.:

require 'securerandom
 SecureRandom.hex(4)
 => "9204aa6c" 

so maybe copy the existing generator to new file that uses SecureRandom#hex(range) and write tests

equivalent commented 5 years ago

ok thank you @ReneIvanov for implementing this in #14

PublicUid::Generators::HexStringSecureRandom will be used as default generator in version 1.3 (https://rubygems.org/gems/public_uid/versions/1.3.0)