From 3565f7550a1d604ed248ad0174af6cccd59f8131 Mon Sep 17 00:00:00 2001 From: mh Date: Fri, 5 Aug 2011 13:11:28 +0200 Subject: add sha(256|512)crypt formats - increase version --- lib/VERSION | 4 ++-- lib/trocla/formats/sha256crypt.rb | 6 ++++++ lib/trocla/formats/sha512crypt.rb | 6 ++++++ 3 files changed, 14 insertions(+), 2 deletions(-) create mode 100644 lib/trocla/formats/sha256crypt.rb create mode 100644 lib/trocla/formats/sha512crypt.rb (limited to 'lib') 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 -- cgit v1.2.3