devise - Why particular characters are hard coded to generate a secured token -
i trying understand philosophy behind harcoding particular characters in generating friendly token. thought process behind this
https://github.com/plataformatec/devise/blob/master/lib/devise.rb#l481
def self.friendly_token(length = 20) # calculate real characters, must perform operation. # see securerandom.urlsafe_base64 rlength = (length * 3) / 4 securerandom.urlsafe_base64(rlength).tr('lio0', 'sxyz') end
here in above snippet, l,i,o,0 getting replaced s, x, y, z respectively. other characters getting generated!
example
securerandom.urlsafe_base64(15) => "4-6rgwuh1sisflxa3c73"
what r, g, w etc?
the reason behind remove characters confusing. (hard distinguish)
like o
can confused 0
like l
can confused i
specific commit introduces explains in commit message
https://github.com/plataformatec/devise/commit/6d65c28f1f709722dd86da49241f118813ea7090
Comments
Post a Comment