Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Encrypt a string to an one way hash Ruby
05-15-2010, 11:02 PM
Post: #1
Encrypt a string to an one way hash Ruby
This program encrypts a string to a one way hash. The crypt method is a built-in function in string variables. It takes a 2 character string for the salt. You can slice off the salt in the hash also if you don't want anybody to know what salt your using for your hash string.

Code:
=begin
This program converts a string to a one way hash
coded by codecaine aka Jerome Scott II
=end
puts 'Enter in a string to that you would like to encrypt into an hash string'
choice = gets #gets a string from an user
puts "Your hash is #{choice.crypt('js')}" #convert the string to an hash tring using js as the salt
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump:


 Quick Theme: