summaryrefslogtreecommitdiff
path: root/lib/trocla
diff options
context:
space:
mode:
authormh <mh@immerda.ch>2011-08-05 13:11:28 +0200
committermh <mh@immerda.ch>2011-08-05 13:11:28 +0200
commit3565f7550a1d604ed248ad0174af6cccd59f8131 (patch)
tree2873b990b651fa3ba7116de642d1185da0287b6a /lib/trocla
parentd70593d2b0a5f19dd0b692dbb0a1e90808a079b6 (diff)
add sha(256|512)crypt formats - increase version
Diffstat (limited to 'lib/trocla')
-rw-r--r--lib/trocla/formats/sha256crypt.rb6
-rw-r--r--lib/trocla/formats/sha512crypt.rb6
2 files changed, 12 insertions, 0 deletions
diff --git a/lib/trocla/formats/sha256crypt.rb b/lib/trocla/formats/sha256crypt.rb
new file mode 100644
index 0000000..fe6659c
--- /dev/null
+++ b/lib/trocla/formats/sha256crypt.rb
@@ -0,0 +1,6 @@
+# salted crypt
+class Trocla::Formats::Sha256crypt
+ def format(plain_password,options={})
+ plain_password.crypt('$5$' << Trocla::Util.random_str(8) << '$')
+ end
+end
diff --git a/lib/trocla/formats/sha512crypt.rb b/lib/trocla/formats/sha512crypt.rb
new file mode 100644
index 0000000..d57b93d
--- /dev/null
+++ b/lib/trocla/formats/sha512crypt.rb
@@ -0,0 +1,6 @@
+# salted crypt
+class Trocla::Formats::Sha512crypt
+ def format(plain_password,options={})
+ plain_password.crypt('$6$' << Trocla::Util.random_str(8) << '$')
+ end
+end