How to find the SHA1 hash of a string in Ruby

To find the SHA1 hash of a string, first include the library 'digest/sha1' then use the code below, where 'password' is the string we're computing the hash of.

CODE:
  1. require ‘digest/sha1′
  2. # ... then later on ...
  3. password = "blah"
  4. sha1_pass = Digest::SHA1.hexdigest(password)

If you have a website, consider joining the Money4Banners advertising network. They will pay you £10 + £5 each month for displaying a small advert on three of your pages, regardless of traffic. American webmasters are welcome, and since £10 == $20, you make more!


No Responses to “How to find the SHA1 hash of a string in Ruby”  

  1. No Comments

Leave a Reply

You must log in to post a comment.


Categories