Return to Snippet

Revision: 80597
at March 21, 2020 23:08 by chrisaiv


Updated URL
https://www.chrisjmendez.com/2007/10/21/ruby-encrypting-passwords-for-a-database-using-one-way-hash-technique-sha1/

Updated Code
https://www.chrisjmendez.com/2007/10/21/ruby-encrypting-passwords-for-a-database-using-one-way-hash-technique-sha1/

Revision: 4072
at October 21, 2007 17:58 by chrisaiv


Initial Code
#A. Import the SHA1 Method
require "digest/sha1"
#B. Encrypt the Password string
@hash_pass = Digest::SHA1.hexdigest('super password')
#C. Display the encrypted password
puts @hash_pass

Initial URL


Initial Description
Before you save a password to a database, it may make sense to encrypt it. That way when you do some user authentication, you can compare the users submitted password to the one on the database.

Initial Title
Encrypting passwords for a database using one-way hash technique (SHA1)

Initial Tags
ruby

Initial Language
Ruby