sixarm_ruby_password_hash 1.2.1 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data.tar.gz.sig +1 -1
- data/.gemtest +0 -0
- data/README.md +107 -0
- data/Rakefile +8 -0
- data/VERSION +1 -0
- data/lib/sixarm_ruby_password_hash.rb +2 -34
- data/test/sixarm_ruby_password_hash_test.rb +27 -16
- metadata +54 -62
- metadata.gz.sig +0 -0
- data/LICENSE.txt +0 -12
- data/README.rdoc +0 -34
data.tar.gz.sig
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
7�K�}<ś�=�L�Y��B���֟4W&-���fm �"��Iƣq(�@�"|}z*�;g4#E,m
|
data/.gemtest
ADDED
File without changes
|
data/README.md
ADDED
@@ -0,0 +1,107 @@
|
|
1
|
+
# SixArm.com » Ruby » <br> PasswordHash class to generate secure SHA256 passwords
|
2
|
+
|
3
|
+
* Docs: <http://sixarm.com/sixarm_ruby_password_hash/doc>
|
4
|
+
* Repo: <http://github.com/sixarm/sixarm_ruby_password_hash>
|
5
|
+
* Email: Joel Parker Henderson, <joel@sixarm.com>
|
6
|
+
|
7
|
+
|
8
|
+
## Introduction
|
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
|
+
For docs go to <http://sixarm.com/sixarm_ruby_password_hash/doc>
|
16
|
+
|
17
|
+
Want to help? We're happy to get pull requests.
|
18
|
+
|
19
|
+
|
20
|
+
## Quickstart
|
21
|
+
|
22
|
+
Install:
|
23
|
+
|
24
|
+
gem install sixarm_ruby_password_hash
|
25
|
+
|
26
|
+
Bundler:
|
27
|
+
|
28
|
+
gem "sixarm_ruby_password_hash", "=1.3.0"
|
29
|
+
|
30
|
+
Require:
|
31
|
+
|
32
|
+
require "sixarm_ruby_password_hash"
|
33
|
+
|
34
|
+
|
35
|
+
## High Security (Optional)
|
36
|
+
|
37
|
+
To enable high security for all our gems:
|
38
|
+
|
39
|
+
wget http://sixarm.com/sixarm.pem
|
40
|
+
gem cert --add sixarm.pem
|
41
|
+
gem sources --add http://sixarm.com
|
42
|
+
|
43
|
+
To install with high security:
|
44
|
+
|
45
|
+
gem install sixarm_ruby_password_hash --test --trust-policy HighSecurity
|
46
|
+
|
47
|
+
|
48
|
+
## Examples
|
49
|
+
|
50
|
+
To create a password:
|
51
|
+
|
52
|
+
require "sixarm_ruby_password_hash"
|
53
|
+
text = "mysecret"
|
54
|
+
salt = "azsxdcfv"
|
55
|
+
hash = PasswordHash.new(text,salt)
|
56
|
+
|
57
|
+
To create a password using our helpers:
|
58
|
+
|
59
|
+
require "sixarm_ruby_password_hash"
|
60
|
+
require "sixarm_ruby_password_salt"
|
61
|
+
require "sixarm_ruby_password_text"
|
62
|
+
text = PasswordText.new
|
63
|
+
salt = PasswordSalt.new
|
64
|
+
hash = PasswordHash.new(text,salt)
|
65
|
+
|
66
|
+
To verify a password:
|
67
|
+
|
68
|
+
hash.valid?(text,salt)
|
69
|
+
|
70
|
+
To verify a password from a web form for a user:
|
71
|
+
|
72
|
+
user = User.find(params[:id]) or raise "user not found"
|
73
|
+
user.hash.valid?(params[:password],user.salt)
|
74
|
+
|
75
|
+
|
76
|
+
## Changes
|
77
|
+
|
78
|
+
* 2012-03-16 1.3.0 Upgrade for Ruby 1.9.3, minitest/spec, and improved docs.
|
79
|
+
|
80
|
+
|
81
|
+
## License
|
82
|
+
|
83
|
+
You may choose any of these open source licenses:
|
84
|
+
|
85
|
+
* Apache License
|
86
|
+
* BSD License
|
87
|
+
* CreativeCommons License, Non-commercial Share Alike
|
88
|
+
* GNU General Public License Version 2 (GPL 2)
|
89
|
+
* GNU Lesser General Public License (LGPL)
|
90
|
+
* MIT License
|
91
|
+
* Perl Artistic License
|
92
|
+
* Ruby License
|
93
|
+
|
94
|
+
The software is provided "as is", without warranty of any kind,
|
95
|
+
express or implied, including but not limited to the warranties of
|
96
|
+
merchantability, fitness for a particular purpose and noninfringement.
|
97
|
+
|
98
|
+
In no event shall the authors or copyright holders be liable for any
|
99
|
+
claim, damages or other liability, whether in an action of contract,
|
100
|
+
tort or otherwise, arising from, out of or in connection with the
|
101
|
+
software or the use or other dealings in the software.
|
102
|
+
|
103
|
+
This license is for the included software that is created by SixArm;
|
104
|
+
some of the included software may have its own licenses, copyrights,
|
105
|
+
authors, etc. and these do take precedence over the SixArm license.
|
106
|
+
|
107
|
+
Copyright (c) 2005-2012 Joel Parker Henderson
|
data/Rakefile
ADDED
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
1.2.1
|
@@ -1,38 +1,6 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
1
2
|
=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
|
-
|
3
|
+
Please see README
|
36
4
|
=end
|
37
5
|
|
38
6
|
require 'digest/sha2'
|
@@ -1,24 +1,35 @@
|
|
1
|
-
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require 'minitest/autorun'
|
3
|
+
require 'simplecov'
|
4
|
+
SimpleCov.start
|
2
5
|
require 'sixarm_ruby_password_hash'
|
3
6
|
|
4
|
-
|
7
|
+
describe PasswordHash do
|
5
8
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
assert(p.is_a?(String),"p is a string")
|
10
|
-
end
|
9
|
+
before do
|
10
|
+
P ||= PasswordHash.new('foo','bar')
|
11
|
+
end
|
11
12
|
|
12
|
-
|
13
|
-
p = PasswordHash.new('foo','bar')
|
14
|
-
assert(p.valid?('foo','bar'), "p.valid? foo bar")
|
15
|
-
end
|
13
|
+
describe ".new" do
|
16
14
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
15
|
+
it "=> String" do
|
16
|
+
P.must_be_kind_of String
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
|
21
|
+
describe "#valid?" do
|
22
|
+
|
23
|
+
it "right args => true" do
|
24
|
+
assert(P.valid?('foo','bar'), "p.valid? foo bar")
|
25
|
+
end
|
26
|
+
|
27
|
+
it "wrong args => false" do
|
28
|
+
refute(P.valid?('foo','xxx'), "p.valid? foo xxx")
|
29
|
+
refute(P.valid?('xxx','bar'), "p.valid? xxx bar")
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
22
33
|
|
23
34
|
end
|
24
35
|
|
metadata
CHANGED
@@ -1,87 +1,79 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: sixarm_ruby_password_hash
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
|
6
|
-
- 1
|
7
|
-
- 2
|
8
|
-
- 1
|
9
|
-
version: 1.2.1
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.3.0
|
5
|
+
prerelease:
|
10
6
|
platform: ruby
|
11
|
-
authors:
|
7
|
+
authors:
|
12
8
|
- SixArm
|
13
9
|
autorequire:
|
14
10
|
bindir: bin
|
15
|
-
cert_chain:
|
16
|
-
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
11
|
+
cert_chain:
|
12
|
+
- !binary |-
|
13
|
+
LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSURCRENDQW0yZ0F3SUJB
|
14
|
+
Z0lKQUtQd0VFVFU1YkhvTUEwR0NTcUdTSWIzRFFFQkJRVUFNR0F4Q3pBSkJn
|
15
|
+
TlYKQkFZVEFsVlRNUk13RVFZRFZRUUlFd3BEWVd4cFptOXlibWxoTVJZd0ZB
|
16
|
+
WURWUVFIRXcxVFlXNGdSbkpoYm1OcApjMk52TVE4d0RRWURWUVFLRXdaVGFY
|
17
|
+
aEJjbTB4RXpBUkJnTlZCQU1UQ25OcGVHRnliUzVqYjIwd0hoY05NVEF4Ck1q
|
18
|
+
RXpNak15TnpFeldoY05NVE13T1RBNE1qTXlOekV6V2pCZ01Rc3dDUVlEVlFR
|
19
|
+
R0V3SlZVekVUTUJFR0ExVUUKQ0JNS1EyRnNhV1p2Y201cFlURVdNQlFHQTFV
|
20
|
+
RUJ4TU5VMkZ1SUVaeVlXNWphWE5qYnpFUE1BMEdBMVVFQ2hNRwpVMmw0UVhK
|
21
|
+
dE1STXdFUVlEVlFRREV3cHphWGhoY20wdVkyOXRNSUdmTUEwR0NTcUdTSWIz
|
22
|
+
RFFFQkFR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RFLS0tLS0K
|
38
|
+
date: 2012-03-16 00:00:00.000000000 Z
|
39
39
|
dependencies: []
|
40
|
-
|
41
40
|
description:
|
42
41
|
email: sixarm@sixarm.com
|
43
42
|
executables: []
|
44
|
-
|
45
43
|
extensions: []
|
46
|
-
|
47
44
|
extra_rdoc_files: []
|
48
|
-
|
49
|
-
|
50
|
-
-
|
51
|
-
-
|
45
|
+
files:
|
46
|
+
- .gemtest
|
47
|
+
- Rakefile
|
48
|
+
- README.md
|
49
|
+
- VERSION
|
52
50
|
- lib/sixarm_ruby_password_hash.rb
|
53
51
|
- test/sixarm_ruby_password_hash_test.rb
|
54
|
-
has_rdoc: true
|
55
52
|
homepage: http://sixarm.com/
|
56
53
|
licenses: []
|
57
|
-
|
58
54
|
post_install_message:
|
59
55
|
rdoc_options: []
|
60
|
-
|
61
|
-
require_paths:
|
56
|
+
require_paths:
|
62
57
|
- lib
|
63
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
58
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
64
59
|
none: false
|
65
|
-
requirements:
|
66
|
-
- -
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
|
69
|
-
|
70
|
-
version: "0"
|
71
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
60
|
+
requirements:
|
61
|
+
- - ! '>='
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: '0'
|
64
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
72
65
|
none: false
|
73
|
-
requirements:
|
74
|
-
- -
|
75
|
-
- !ruby/object:Gem::Version
|
76
|
-
|
77
|
-
- 0
|
78
|
-
version: "0"
|
66
|
+
requirements:
|
67
|
+
- - ! '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
79
70
|
requirements: []
|
80
|
-
|
81
71
|
rubyforge_project:
|
82
|
-
rubygems_version: 1.
|
72
|
+
rubygems_version: 1.8.11
|
83
73
|
signing_key:
|
84
74
|
specification_version: 3
|
85
|
-
summary:
|
86
|
-
|
75
|
+
summary: SixArm.com » Ruby » PasswordHash class for secure password hashing with plain
|
76
|
+
text and random salt
|
77
|
+
test_files:
|
87
78
|
- test/sixarm_ruby_password_hash_test.rb
|
79
|
+
has_rdoc: true
|
metadata.gz.sig
CHANGED
Binary file
|
data/LICENSE.txt
DELETED
@@ -1,12 +0,0 @@
|
|
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.
|
data/README.rdoc
DELETED
@@ -1,34 +0,0 @@
|
|
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
|
-
|