webget_ruby_password_salt 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,40 @@
1
+ =begin rdoc
2
+
3
+ = WebGet Ruby Gem: Password Salt
4
+
5
+ Author:: Joel Parker Henderson, joelparkerhenderson@gmail.com
6
+ Copyright:: Copyright (c) 2006-2010 Joel Parker Henderson
7
+ License:: CreativeCommons License, Non-commercial Share Alike
8
+ License:: LGPL, GNU Lesser General Public License
9
+
10
+ Password tool to create strong user-friendly salt for hashes,
11
+ using Ruby's secure random cryptographic functions.
12
+
13
+ Example:
14
+ require 'webget_ruby_password_salt'
15
+ PasswordSalt.new => "ezkabtsu"
16
+
17
+ This generates a secure random 8 character salt
18
+ of all lowercase letters with 26^8 combinations.
19
+ This can easily be sent via web URIs, email, etc.
20
+
21
+ Ruby 1.8.6 and older does not have a secure random number method,
22
+ so we check to see if SecureRandom is defined; if it is not defined,
23
+ then we require our webget_ruby_secure_random gem for the method.
24
+
25
+ =end
26
+
27
+
28
+ if !defined?(SecureRandom) then require 'webget_ruby_secure_random' end
29
+
30
+
31
+ class PasswordSalt < String
32
+
33
+ COUNT = 8
34
+ CHARS = ('a'..'z').to_a
35
+
36
+ def initialize
37
+ super(Array.new(COUNT){CHARS[SecureRandom.random_number(CHARS.size)]}.join)
38
+ end
39
+
40
+ end
@@ -0,0 +1,15 @@
1
+ require 'test/unit'
2
+ require 'webget_ruby_password_salt'
3
+
4
+ class Testing < Test::Unit::TestCase
5
+
6
+ def test_all
7
+ 20.times{
8
+ x=PasswordSalt.new
9
+ assert(x.is_a?(String))
10
+ assert_equal(x.length,PasswordSalt::COUNT)
11
+ assert(x=~/^[a-z]+$/,"lowercase letters:#{x}")
12
+ }
13
+ end
14
+
15
+ end
data.tar.gz.sig ADDED
Binary file
metadata ADDED
@@ -0,0 +1,87 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: webget_ruby_password_salt
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.2.0
5
+ platform: ruby
6
+ authors:
7
+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IEZyYW5jaXNjbzETMBEGA1UEChMKV2ViR2V0LmNvbTETMBEGA1UE
28
+ CxMKV2ViR2V0LmNvbTETMBEGA1UEAxMKV2ViR2V0LmNvbTEgMB4GCSqGSIb3DQEJ
29
+ ARYRd2ViZ2V0QHdlYmdldC5jb22CCQCJUqhJA0GmSDAMBgNVHRMEBTADAQH/MA0G
30
+ CSqGSIb3DQEBBQUAA4GBADzVXlwuff0/w3yK4LflGKKhtC3oChIrwmSyP6tk628N
31
+ BHokpc4Kz63xSXqzYTnBS7rFBwlYThtNalQeWmoUjGh3Z0ZR0JlhU0ln8899LuJ3
32
+ DXnLFY0cVuBnNDMOOFl8vk1qIcZjcTovhzgcixpG6Uk5qmUsKHRLQf4oQJx7TfLK
33
+ -----END CERTIFICATE-----
34
+
35
+ date: 2010-02-17 00:00:00 -08:00
36
+ default_executable:
37
+ dependencies:
38
+ - !ruby/object:Gem::Dependency
39
+ name: webget_ruby_secure_random
40
+ type: :runtime
41
+ version_requirement:
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: 1.2.0
47
+ version:
48
+ description:
49
+ email: webget@webget.com
50
+ executables: []
51
+
52
+ extensions: []
53
+
54
+ extra_rdoc_files: []
55
+
56
+ files:
57
+ - lib/webget_ruby_password_salt.rb
58
+ has_rdoc: true
59
+ homepage: http://webget.com/
60
+ licenses: []
61
+
62
+ post_install_message:
63
+ rdoc_options: []
64
+
65
+ require_paths:
66
+ - lib
67
+ required_ruby_version: !ruby/object:Gem::Requirement
68
+ requirements:
69
+ - - ">="
70
+ - !ruby/object:Gem::Version
71
+ version: "0"
72
+ version:
73
+ required_rubygems_version: !ruby/object:Gem::Requirement
74
+ requirements:
75
+ - - ">="
76
+ - !ruby/object:Gem::Version
77
+ version: "0"
78
+ version:
79
+ requirements: []
80
+
81
+ rubyforge_project:
82
+ rubygems_version: 1.3.5
83
+ signing_key:
84
+ specification_version: 3
85
+ summary: "WebGet Ruby Gem: PasswordSalt class to generate secure websafe strings using random cryptography"
86
+ test_files:
87
+ - test/webget_ruby_password_salt_test.rb
metadata.gz.sig ADDED
@@ -0,0 +1 @@
1
+ ����ȯlW ��T�<�f-��!7)ǿ�EǍio�g�WB�V�$�`��ѤT뢹��T`����=�,)S�jke