summaryrefslogtreecommitdiff
path: root/lib
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
parentd70593d2b0a5f19dd0b692dbb0a1e90808a079b6 (diff)
add sha(256|512)crypt formats - increase version
Diffstat (limited to 'lib')
-rw-r--r--lib/VERSION4
-rw-r--r--lib/trocla/formats/sha256crypt.rb6
-rw-r--r--lib/trocla/formats/sha512crypt.rb6
3 files changed, 14 insertions, 2 deletions
diff --git a/lib/VERSION b/lib/VERSION
index a81c87a..013802f 100644
--- a/lib/VERSION
+++ b/lib/VERSION
@@ -1,4 +1,4 @@
major:0
minor:0
-patch:1
-build: \ No newline at end of file
+patch:2
+build:
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