gandalf v0.2.0 Gandalf.Utils.Crypt

Crypt utilities

Summary

Functions

Generates a random string

Compares string with Bcrypted version of the string

Generate a salt from given string

Functions

generate_token()

Generates a random string

Examples

Gandalf.Utils.Crypt.generate_token
# "ve7LXBsGqsvsXXjiFS1PVQ"
match_password(password, crypted_password)

Compares string with Bcrypted version of the string.

Returns true if mathes, otherwise false

Examples

Gandalf.Utils.Crypt.match_password("12345678",
  "$2b$12$wHkoEnYQ03mWH1CsByPB4ek4xu7QXIFYl5gAC6b8zYs3aj/9DNv3u"
)
salt_password(password)

Generate a salt from given string.

Returns crypted string

Examples

Gandalf.Utils.Crypt.salt_password("12345678")
# "$2b$12$wHkoEnYQ03mWH1CsByPB4ek4xu7QXIFYl5gAC6b8zYs3aj/9DNv3u"