summaryrefslogtreecommitdiff
path: root/lib/trocla/formats/ssha.rb
blob: eaac6bbeafee5bb0cd878ee21f26abbc11a4a696 (plain)
1
2
3
4
5
6
7
8
9
# salted crypt
require 'base64'
require 'digest'
class Trocla::Formats::Ssha
  def format(plain_password,options={})
     salt = options['salt'] || Trocla::Util.salt(16)
     "{SSHA}"+Base64.encode64("#{Digest::SHA1.digest("#{plain_password}#{salt}")}#{salt}").chomp
  end
end