sixarm_ruby_password_hash 1.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ ������7.c���X����!Vw��_�/YN�
@@ -0,0 +1,12 @@
1
+ LICENSE
2
+
3
+ You may choose any of these licenses:
4
+
5
+ - CreativeCommons License, Non-commercial Share Alike
6
+ - LGPL, GNU Lesser General Public License
7
+ - MIT License
8
+ - Ruby License
9
+
10
+ THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
11
+ IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
12
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
@@ -0,0 +1,34 @@
1
+
2
+ = SixArm Ruby Gem: Password Hash to do secure SHA256 passwords.
3
+
4
+ Author:: Joel Parker Henderson, joelparkerhenderson@gmail.com
5
+ Copyright:: Copyright (c) 2006-2010 Joel Parker Henderson
6
+ License:: CreativeCommons License, Non-commercial Share Alike
7
+ License:: LGPL, GNU Lesser General Public License
8
+
9
+ Password hash tool to create secure passwords,
10
+
11
+ This uses SHA256 hexdigest for the cryptographic hash,
12
+ and authenticates a password, salt, and hash.
13
+
14
+ To create a password:
15
+ require 'sixarm_ruby_password_hash'
16
+ text = 'mysecret'
17
+ salt = 'azsxdcfv'
18
+ hash = PasswordHash.new(text,salt)
19
+
20
+ To create a password using our helpers:
21
+ require 'sixarm_ruby_password_hash'
22
+ require 'sixarm_ruby_password_salt'
23
+ require 'sixarm_ruby_password_text'
24
+ text = PasswordText.new
25
+ salt = PasswordSalt.new
26
+ hash = PasswordHash.new(text,salt)
27
+
28
+ To verify a password:
29
+ hash.valid?(text,salt)
30
+
31
+ To verify a password from a web form for a user:
32
+ user = User.find(params[:id]) or raise 'user not found'
33
+ user.hash.valid?(params[:password],user.salt)
34
+
@@ -0,0 +1,52 @@
1
+ =begin rdoc
2
+
3
+ = SixArm Ruby Gem: Password Hash to do secure SHA256 passwords.
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 hash tool to create secure passwords,
11
+
12
+ This uses SHA256 hexdigest for the cryptographic hash,
13
+ and authenticates a password, salt, and hash.
14
+
15
+ To create a password:
16
+ require 'sixarm_ruby_password_hash'
17
+ text = 'mysecret'
18
+ salt = 'azsxdcfv'
19
+ hash = PasswordHash.new(text,salt)
20
+
21
+ To create a password using our helpers:
22
+ require 'sixarm_ruby_password_hash'
23
+ require 'sixarm_ruby_password_salt'
24
+ require 'sixarm_ruby_password_text'
25
+ text = PasswordText.new
26
+ salt = PasswordSalt.new
27
+ hash = PasswordHash.new(text,salt)
28
+
29
+ To verify a password:
30
+ hash.valid?(text,salt)
31
+
32
+ To verify a password from a web form for a user:
33
+ user = User.find(params[:id]) or raise 'user not found'
34
+ user.hash.valid?(params[:password],user.salt)
35
+
36
+ =end
37
+
38
+ require 'digest/sha2'
39
+
40
+ class PasswordHash < String
41
+
42
+ def initialize(text,salt)
43
+ text or raise "text:#{text}"
44
+ salt or raise "salt:#{salt}"
45
+ super(Digest::SHA256.hexdigest(text+salt))
46
+ end
47
+
48
+ def valid?(text,salt)
49
+ self == Digest::SHA256.hexdigest(text+salt)
50
+ end
51
+
52
+ end
@@ -0,0 +1,24 @@
1
+ require 'test/unit'
2
+ require 'sixarm_ruby_password_hash'
3
+
4
+ class Testing < Test::Unit::TestCase
5
+
6
+ def test_new
7
+ p = PasswordHash.new('foo','bar')
8
+ assert_not_nil(p,"p")
9
+ assert(p.is_a?(String),"p is a string")
10
+ end
11
+
12
+ def test_valid
13
+ p = PasswordHash.new('foo','bar')
14
+ assert(p.valid?('foo','bar'), "p.valid? foo bar")
15
+ end
16
+
17
+ def test_invalid
18
+ p = PasswordHash.new('foo','bar')
19
+ assert(!p.valid?('foo','xxx'), "p.valid? foo xxx")
20
+ assert(!p.valid?('xxx','bar'), "p.valid? xxx bar")
21
+ end
22
+
23
+ end
24
+
metadata ADDED
@@ -0,0 +1,87 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: sixarm_ruby_password_hash
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 1
7
+ - 2
8
+ - 1
9
+ version: 1.2.1
10
+ platform: ruby
11
+ authors:
12
+ - SixArm
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain:
16
+ - |
17
+ -----BEGIN CERTIFICATE-----
18
+ MIIDBDCCAm2gAwIBAgIJAKPwEETU5bHoMA0GCSqGSIb3DQEBBQUAMGAxCzAJBgNV
19
+ BAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQHEw1TYW4gRnJhbmNp
20
+ c2NvMQ8wDQYDVQQKEwZTaXhBcm0xEzARBgNVBAMTCnNpeGFybS5jb20wHhcNMTAx
21
+ MjEzMjMyNzEzWhcNMTMwOTA4MjMyNzEzWjBgMQswCQYDVQQGEwJVUzETMBEGA1UE
22
+ CBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNU2FuIEZyYW5jaXNjbzEPMA0GA1UEChMG
23
+ U2l4QXJtMRMwEQYDVQQDEwpzaXhhcm0uY29tMIGfMA0GCSqGSIb3DQEBAQUAA4GN
24
+ ADCBiQKBgQC94mD9JDwBsunsOI0VR3CXXbOWg9cWaWciwFyJNFiM7A9I8KPLfXUw
25
+ QC4czUe5ZuG4WHvinrWhkrCK+1dWBqoEClxdF/FoKO5a+tonGCjjmfy81JmFjjyx
26
+ eTsjsHyvw+Qik9kpf9aj6+pnkNrVswgNHVea2o9yabbEiS6VSeJWoQIDAQABo4HF
27
+ MIHCMB0GA1UdDgQWBBQzPJtqmSgc53eDN7aSzDQwr9TALDCBkgYDVR0jBIGKMIGH
28
+ gBQzPJtqmSgc53eDN7aSzDQwr9TALKFkpGIwYDELMAkGA1UEBhMCVVMxEzARBgNV
29
+ BAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNhbiBGcmFuY2lzY28xDzANBgNVBAoT
30
+ BlNpeEFybTETMBEGA1UEAxMKc2l4YXJtLmNvbYIJAKPwEETU5bHoMAwGA1UdEwQF
31
+ MAMBAf8wDQYJKoZIhvcNAQEFBQADgYEAooEexP/oPam1TP71SyuhxMb+uTrZbSQe
32
+ jVB+ExRwWadGwaNPUA56d39qwavwP+iu+3JpeonNMVvbWXF5naCX/dNFIeREHzER
33
+ ZDRQYMqru9TEMna6HD9zpcstF7vwThGovlOQ+3Y6plQ4nMzipXcZ9THqs65PIL0q
34
+ eabwpCbAopo=
35
+ -----END CERTIFICATE-----
36
+
37
+ date: 2010-12-13 00:00:00 -08:00
38
+ default_executable:
39
+ dependencies: []
40
+
41
+ description:
42
+ email: sixarm@sixarm.com
43
+ executables: []
44
+
45
+ extensions: []
46
+
47
+ extra_rdoc_files: []
48
+
49
+ files:
50
+ - README.rdoc
51
+ - LICENSE.txt
52
+ - lib/sixarm_ruby_password_hash.rb
53
+ - test/sixarm_ruby_password_hash_test.rb
54
+ has_rdoc: true
55
+ homepage: http://sixarm.com/
56
+ licenses: []
57
+
58
+ post_install_message:
59
+ rdoc_options: []
60
+
61
+ require_paths:
62
+ - lib
63
+ required_ruby_version: !ruby/object:Gem::Requirement
64
+ none: false
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ segments:
69
+ - 0
70
+ version: "0"
71
+ required_rubygems_version: !ruby/object:Gem::Requirement
72
+ none: false
73
+ requirements:
74
+ - - ">="
75
+ - !ruby/object:Gem::Version
76
+ segments:
77
+ - 0
78
+ version: "0"
79
+ requirements: []
80
+
81
+ rubyforge_project:
82
+ rubygems_version: 1.3.7
83
+ signing_key:
84
+ specification_version: 3
85
+ summary: "SixArm Ruby Gem: PasswordHash class for secure password hashing with plain text and random salt"
86
+ test_files:
87
+ - test/sixarm_ruby_password_hash_test.rb
@@ -0,0 +1 @@
1
+ W�Eh��.�t�! �N���p��~[������/��i�'�?�dz�yb���������+<�6dR�|�ye\d�+��tg��h0��Ww3�h��b�f�?� ��vؓ:����7��x��S