summaryrefslogtreecommitdiff
path: root/lib/trocla
diff options
context:
space:
mode:
Diffstat (limited to 'lib/trocla')
-rw-r--r--lib/trocla/formats/ssha.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/trocla/formats/ssha.rb b/lib/trocla/formats/ssha.rb
new file mode 100644
index 0000000..eaac6bb
--- /dev/null
+++ b/lib/trocla/formats/ssha.rb
@@ -0,0 +1,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