Sha256: 70bb9c28a8345633ee5cfdc9306e5ea9acce68279e60a9b9a6ed2d92f7a6f3b4
Contents?: true
Size: 538 Bytes
Versions: 2
Compression:
Stored size: 538 Bytes
Contents
# https://github.com/plataformatec/devise # module SimpleTokenAuth module Helpers # Generate a friendly string randomly to be used as token. def friendly_token SecureRandom.urlsafe_base64(15).tr('lIO0', 'sxyz') end # constant-time comparison algorithm to prevent timing attacks def secure_compare(a, b) return false if a.blank? || b.blank? || a.bytesize != b.bytesize l = a.unpack "C#{a.bytesize}" res = 0 b.each_byte { |byte| res |= byte ^ l.shift } res == 0 end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
simple_token_auth-0.0.4 | lib/simple_token_auth/helpers.rb |
simple_token_auth-0.0.3 | lib/simple_token_auth/helpers.rb |