Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require 'sha1'
- require 'md5'
- class Authorization
- class << self
- def check( enc_password, raw_password )
- algo, salt, hsh = enc_password.split( "$" )
- case algo
- when "md5" then MD5.md5( salt + raw_password ).to_s == hsh
- when "sha1" then SHA1.sha1( salt + raw_password ).to_s == hsh
- else
- false
- end
- end
- end
- end
Add Comment
Please, Sign In to add comment