auto_hash 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (80) hide show
  1. data/.document +5 -0
  2. data/.gitignore +22 -0
  3. data/LICENSE +20 -0
  4. data/README.rdoc +54 -0
  5. data/Rakefile +41 -0
  6. data/VERSION +1 -0
  7. data/auto_hash.gemspec +160 -0
  8. data/created.rid +1 -0
  9. data/init.rb +4 -0
  10. data/lib/auto_hash.rb +85 -0
  11. data/log/test.log +0 -0
  12. data/test/common/user_test.rb +59 -0
  13. data/test/rails2x_root/Rakefile +10 -0
  14. data/test/rails2x_root/app/controllers/application_controller.rb +10 -0
  15. data/test/rails2x_root/app/helpers/application_helper.rb +3 -0
  16. data/test/rails2x_root/app/models/user.rb +5 -0
  17. data/test/rails2x_root/config/boot.rb +110 -0
  18. data/test/rails2x_root/config/database.yml +22 -0
  19. data/test/rails2x_root/config/environment.rb +29 -0
  20. data/test/rails2x_root/config/environments/development.rb +17 -0
  21. data/test/rails2x_root/config/environments/production.rb +28 -0
  22. data/test/rails2x_root/config/environments/test.rb +28 -0
  23. data/test/rails2x_root/config/initializers/backtrace_silencers.rb +7 -0
  24. data/test/rails2x_root/config/initializers/cookie_verification_secret.rb +7 -0
  25. data/test/rails2x_root/config/initializers/inflections.rb +10 -0
  26. data/test/rails2x_root/config/initializers/mime_types.rb +5 -0
  27. data/test/rails2x_root/config/initializers/new_rails_defaults.rb +21 -0
  28. data/test/rails2x_root/config/initializers/session_store.rb +15 -0
  29. data/test/rails2x_root/config/locales/en.yml +5 -0
  30. data/test/rails2x_root/config/routes.rb +43 -0
  31. data/test/rails2x_root/db/development.sqlite3 +0 -0
  32. data/test/rails2x_root/db/migrate/20100803040436_create_users.rb +13 -0
  33. data/test/rails2x_root/db/schema.rb +21 -0
  34. data/test/rails2x_root/db/seeds.rb +7 -0
  35. data/test/rails2x_root/db/test.sqlite3 +0 -0
  36. data/test/rails2x_root/log/development.log +1362 -0
  37. data/test/rails2x_root/log/production.log +0 -0
  38. data/test/rails2x_root/log/server.log +0 -0
  39. data/test/rails2x_root/log/test.log +74 -0
  40. data/test/rails2x_root/script/about +4 -0
  41. data/test/rails2x_root/script/console +3 -0
  42. data/test/rails2x_root/script/dbconsole +3 -0
  43. data/test/rails2x_root/script/destroy +3 -0
  44. data/test/rails2x_root/script/generate +3 -0
  45. data/test/rails2x_root/script/performance/benchmarker +3 -0
  46. data/test/rails2x_root/script/performance/profiler +3 -0
  47. data/test/rails2x_root/script/plugin +3 -0
  48. data/test/rails2x_root/script/runner +3 -0
  49. data/test/rails2x_root/script/server +3 -0
  50. data/test/rails2x_root/test/test_helper.rb +39 -0
  51. data/test/rails2x_root/test/unit/user_test.rb +59 -0
  52. data/test/rails3x_root/.gitignore +4 -0
  53. data/test/rails3x_root/Gemfile +33 -0
  54. data/test/rails3x_root/Gemfile.lock +81 -0
  55. data/test/rails3x_root/Rakefile +7 -0
  56. data/test/rails3x_root/app/controllers/application_controller.rb +3 -0
  57. data/test/rails3x_root/app/helpers/application_helper.rb +2 -0
  58. data/test/rails3x_root/app/models/user.rb +6 -0
  59. data/test/rails3x_root/app/views/layouts/application.html.erb +14 -0
  60. data/test/rails3x_root/config/application.rb +42 -0
  61. data/test/rails3x_root/config/boot.rb +13 -0
  62. data/test/rails3x_root/config/database.yml +22 -0
  63. data/test/rails3x_root/config/environment.rb +6 -0
  64. data/test/rails3x_root/config/environments/development.rb +22 -0
  65. data/test/rails3x_root/config/environments/production.rb +49 -0
  66. data/test/rails3x_root/config/environments/test.rb +35 -0
  67. data/test/rails3x_root/config/initializers/backtrace_silencers.rb +7 -0
  68. data/test/rails3x_root/config/initializers/inflections.rb +10 -0
  69. data/test/rails3x_root/config/initializers/mime_types.rb +5 -0
  70. data/test/rails3x_root/config/initializers/secret_token.rb +7 -0
  71. data/test/rails3x_root/config/initializers/session_store.rb +8 -0
  72. data/test/rails3x_root/config/locales/en.yml +5 -0
  73. data/test/rails3x_root/config/routes.rb +58 -0
  74. data/test/rails3x_root/db/migrate/20100804020911_create_users.rb +13 -0
  75. data/test/rails3x_root/db/schema.rb +22 -0
  76. data/test/rails3x_root/db/seeds.rb +7 -0
  77. data/test/rails3x_root/script/rails +6 -0
  78. data/test/rails3x_root/test/test_helper.rb +13 -0
  79. data/test/rails3x_root/test/unit/user_test.rb +59 -0
  80. metadata +188 -0
data/.document ADDED
@@ -0,0 +1,5 @@
1
+ README.rdoc
2
+ lib/**/*.rb
3
+ bin/*
4
+ features/**/*.feature
5
+ LICENSE
data/.gitignore ADDED
@@ -0,0 +1,22 @@
1
+ ## MAC OS
2
+ .DS_Store
3
+
4
+ ## TEXTMATE
5
+ *.tmproj
6
+ tmtags
7
+
8
+ ## EMACS
9
+ *~
10
+ \#*
11
+ .\#*
12
+
13
+ ## VIM
14
+ *.swp
15
+
16
+ ## PROJECT::GENERAL
17
+ coverage
18
+ rdoc
19
+ pkg
20
+
21
+ ## PROJECT::SPECIFIC
22
+ README.html
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2009 Kevin Swope
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.rdoc ADDED
@@ -0,0 +1,54 @@
1
+ = auto_hash
2
+
3
+ A Ruby on Rails plugin to automate hashing an activerecord field and
4
+ saving as a salt and digest in a single field.
5
+
6
+ Works with both rails 2x and 3x
7
+
8
+ == Synopsis
9
+
10
+ # In Model
11
+ class User < ActiveRecord::Base
12
+ auto_hash :password
13
+ end
14
+
15
+ # Elsewhere
16
+ user = User.new(:username => "kevin", :password => "asdf")
17
+ user.password #=> "6cc4ce889e770343f4b0d3708851f6624b5c1dda4bc4b6dd23ace50328fcd3e0-b99d218de031fad5df71"
18
+ user.password_hash_match?("asdf") # => true
19
+
20
+ # works with updating fields also
21
+ user = User.find_by_username("kevin")
22
+ user.password = "better_password"
23
+ user.password_hash_match?("better_password") # => true
24
+
25
+ == Installing
26
+
27
+ sudo gem install auto_hash
28
+
29
+ For rails 2x, in environment.rb
30
+ Rails::Initializer.run do |config| do
31
+ config.gem "auto_hash"
32
+ end
33
+
34
+ For rails 3x, in Gemfile
35
+ gem "auto_hash"
36
+
37
+
38
+ == Details
39
+
40
+ The hashing is pretty simple, you'll find something like this in the source:
41
+
42
+ salt = ActiveSupport::SecureRandom.hex(10)
43
+ hash = Digest::SHA2.new.update(value + salt).to_s
44
+
45
+ The value stored in the database field is a hash appended with its salt, as
46
+ "hash-salt"
47
+
48
+ In case you weren't sure, a salt is not necessarily a secret - its
49
+ simply a way to defeat dictionary attacks by adding huge variety to
50
+ the hashed value.
51
+
52
+ == Copyright
53
+
54
+ Copyright (c) 2010 Kevin Swope. See LICENSE for details.
data/Rakefile ADDED
@@ -0,0 +1,41 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+ require 'rake/testtask'
4
+
5
+ begin
6
+ require 'jeweler'
7
+ Jeweler::Tasks.new do |gem|
8
+ summary = %Q{Ruby on Rails plugin to automate hashing an activerecord field and saving as a salt and digest in a single field.}
9
+ gem.name = "auto_hash"
10
+ gem.summary = summary
11
+ gem.description = summary
12
+ gem.email = "gems-kevdev@snkmail.com"
13
+ gem.homepage = "http://github.com/kswope/auto_hash"
14
+ gem.authors = ["Kevin Swope"]
15
+ # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
16
+ end
17
+ Jeweler::GemcutterTasks.new
18
+ rescue LoadError
19
+ puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
20
+ end
21
+
22
+ desc "build README.html from README.doc (for previewing in browser)"
23
+ task :readme do
24
+ system "rdoc README.rdoc --one-file > README.html"
25
+ end
26
+
27
+ task :default => :test
28
+ task :test => [:test_rails2x, :test_rails3x]
29
+
30
+ task :test_rails2x do |t|
31
+ chdir "test/rails2x_root" do
32
+ system "rake"
33
+ end
34
+ end
35
+
36
+ task :test_rails3x do |t|
37
+ chdir "test/rails3x_root" do
38
+ system "rake"
39
+ end
40
+ end
41
+
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.1.0
data/auto_hash.gemspec ADDED
@@ -0,0 +1,160 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{auto_hash}
8
+ s.version = "0.1.0"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Kevin Swope"]
12
+ s.date = %q{2010-08-05}
13
+ s.description = %q{Ruby on Rails plugin to automate hashing an activerecord field and saving as a salt and digest in a single field.}
14
+ s.email = %q{gems-kevdev@snkmail.com}
15
+ s.extra_rdoc_files = [
16
+ "LICENSE",
17
+ "README.html",
18
+ "README.rdoc"
19
+ ]
20
+ s.files = [
21
+ ".document",
22
+ ".gitignore",
23
+ "LICENSE",
24
+ "README.rdoc",
25
+ "Rakefile",
26
+ "VERSION",
27
+ "auto_hash.gemspec",
28
+ "created.rid",
29
+ "init.rb",
30
+ "lib/auto_hash.rb",
31
+ "log/test.log",
32
+ "test/common/user_test.rb",
33
+ "test/rails2x_root/Rakefile",
34
+ "test/rails2x_root/app/controllers/application_controller.rb",
35
+ "test/rails2x_root/app/helpers/application_helper.rb",
36
+ "test/rails2x_root/app/models/user.rb",
37
+ "test/rails2x_root/config/boot.rb",
38
+ "test/rails2x_root/config/database.yml",
39
+ "test/rails2x_root/config/environment.rb",
40
+ "test/rails2x_root/config/environments/development.rb",
41
+ "test/rails2x_root/config/environments/production.rb",
42
+ "test/rails2x_root/config/environments/test.rb",
43
+ "test/rails2x_root/config/initializers/backtrace_silencers.rb",
44
+ "test/rails2x_root/config/initializers/cookie_verification_secret.rb",
45
+ "test/rails2x_root/config/initializers/inflections.rb",
46
+ "test/rails2x_root/config/initializers/mime_types.rb",
47
+ "test/rails2x_root/config/initializers/new_rails_defaults.rb",
48
+ "test/rails2x_root/config/initializers/session_store.rb",
49
+ "test/rails2x_root/config/locales/en.yml",
50
+ "test/rails2x_root/config/routes.rb",
51
+ "test/rails2x_root/db/development.sqlite3",
52
+ "test/rails2x_root/db/migrate/20100803040436_create_users.rb",
53
+ "test/rails2x_root/db/schema.rb",
54
+ "test/rails2x_root/db/seeds.rb",
55
+ "test/rails2x_root/db/test.sqlite3",
56
+ "test/rails2x_root/log/development.log",
57
+ "test/rails2x_root/log/production.log",
58
+ "test/rails2x_root/log/server.log",
59
+ "test/rails2x_root/log/test.log",
60
+ "test/rails2x_root/script/about",
61
+ "test/rails2x_root/script/console",
62
+ "test/rails2x_root/script/dbconsole",
63
+ "test/rails2x_root/script/destroy",
64
+ "test/rails2x_root/script/generate",
65
+ "test/rails2x_root/script/performance/benchmarker",
66
+ "test/rails2x_root/script/performance/profiler",
67
+ "test/rails2x_root/script/plugin",
68
+ "test/rails2x_root/script/runner",
69
+ "test/rails2x_root/script/server",
70
+ "test/rails2x_root/test/test_helper.rb",
71
+ "test/rails2x_root/test/unit/user_test.rb",
72
+ "test/rails3x_root/.gitignore",
73
+ "test/rails3x_root/Gemfile",
74
+ "test/rails3x_root/Gemfile.lock",
75
+ "test/rails3x_root/Rakefile",
76
+ "test/rails3x_root/app/controllers/application_controller.rb",
77
+ "test/rails3x_root/app/helpers/application_helper.rb",
78
+ "test/rails3x_root/app/models/user.rb",
79
+ "test/rails3x_root/app/views/layouts/application.html.erb",
80
+ "test/rails3x_root/config/application.rb",
81
+ "test/rails3x_root/config/boot.rb",
82
+ "test/rails3x_root/config/database.yml",
83
+ "test/rails3x_root/config/environment.rb",
84
+ "test/rails3x_root/config/environments/development.rb",
85
+ "test/rails3x_root/config/environments/production.rb",
86
+ "test/rails3x_root/config/environments/test.rb",
87
+ "test/rails3x_root/config/initializers/backtrace_silencers.rb",
88
+ "test/rails3x_root/config/initializers/inflections.rb",
89
+ "test/rails3x_root/config/initializers/mime_types.rb",
90
+ "test/rails3x_root/config/initializers/secret_token.rb",
91
+ "test/rails3x_root/config/initializers/session_store.rb",
92
+ "test/rails3x_root/config/locales/en.yml",
93
+ "test/rails3x_root/config/routes.rb",
94
+ "test/rails3x_root/db/migrate/20100804020911_create_users.rb",
95
+ "test/rails3x_root/db/schema.rb",
96
+ "test/rails3x_root/db/seeds.rb",
97
+ "test/rails3x_root/script/rails",
98
+ "test/rails3x_root/test/test_helper.rb",
99
+ "test/rails3x_root/test/unit/user_test.rb"
100
+ ]
101
+ s.homepage = %q{http://github.com/kswope/auto_hash}
102
+ s.rdoc_options = ["--charset=UTF-8"]
103
+ s.require_paths = ["lib"]
104
+ s.rubygems_version = %q{1.3.7}
105
+ s.summary = %q{Ruby on Rails plugin to automate hashing an activerecord field and saving as a salt and digest in a single field.}
106
+ s.test_files = [
107
+ "test/common/user_test.rb",
108
+ "test/rails2x_root/app/controllers/application_controller.rb",
109
+ "test/rails2x_root/app/helpers/application_helper.rb",
110
+ "test/rails2x_root/app/models/user.rb",
111
+ "test/rails2x_root/config/boot.rb",
112
+ "test/rails2x_root/config/environment.rb",
113
+ "test/rails2x_root/config/environments/development.rb",
114
+ "test/rails2x_root/config/environments/production.rb",
115
+ "test/rails2x_root/config/environments/test.rb",
116
+ "test/rails2x_root/config/initializers/backtrace_silencers.rb",
117
+ "test/rails2x_root/config/initializers/cookie_verification_secret.rb",
118
+ "test/rails2x_root/config/initializers/inflections.rb",
119
+ "test/rails2x_root/config/initializers/mime_types.rb",
120
+ "test/rails2x_root/config/initializers/new_rails_defaults.rb",
121
+ "test/rails2x_root/config/initializers/session_store.rb",
122
+ "test/rails2x_root/config/routes.rb",
123
+ "test/rails2x_root/db/migrate/20100803040436_create_users.rb",
124
+ "test/rails2x_root/db/schema.rb",
125
+ "test/rails2x_root/db/seeds.rb",
126
+ "test/rails2x_root/test/test_helper.rb",
127
+ "test/rails2x_root/test/unit/user_test.rb",
128
+ "test/rails3x_root/app/controllers/application_controller.rb",
129
+ "test/rails3x_root/app/helpers/application_helper.rb",
130
+ "test/rails3x_root/app/models/user.rb",
131
+ "test/rails3x_root/config/application.rb",
132
+ "test/rails3x_root/config/boot.rb",
133
+ "test/rails3x_root/config/environment.rb",
134
+ "test/rails3x_root/config/environments/development.rb",
135
+ "test/rails3x_root/config/environments/production.rb",
136
+ "test/rails3x_root/config/environments/test.rb",
137
+ "test/rails3x_root/config/initializers/backtrace_silencers.rb",
138
+ "test/rails3x_root/config/initializers/inflections.rb",
139
+ "test/rails3x_root/config/initializers/mime_types.rb",
140
+ "test/rails3x_root/config/initializers/secret_token.rb",
141
+ "test/rails3x_root/config/initializers/session_store.rb",
142
+ "test/rails3x_root/config/routes.rb",
143
+ "test/rails3x_root/db/migrate/20100804020911_create_users.rb",
144
+ "test/rails3x_root/db/schema.rb",
145
+ "test/rails3x_root/db/seeds.rb",
146
+ "test/rails3x_root/test/test_helper.rb",
147
+ "test/rails3x_root/test/unit/user_test.rb"
148
+ ]
149
+
150
+ if s.respond_to? :specification_version then
151
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
152
+ s.specification_version = 3
153
+
154
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
155
+ else
156
+ end
157
+ else
158
+ end
159
+ end
160
+
data/created.rid ADDED
@@ -0,0 +1 @@
1
+ Thu, 05 Aug 2010 03:08:52 -0400
data/init.rb ADDED
@@ -0,0 +1,4 @@
1
+
2
+ # NOTE: this file is for rails 2x only
3
+
4
+ require "auto_hash"
data/lib/auto_hash.rb ADDED
@@ -0,0 +1,85 @@
1
+
2
+ module AutoHash
3
+
4
+ def self.included(base)
5
+ base.send :extend, ClassMethods
6
+ end
7
+
8
+ module ClassMethods
9
+
10
+ # This is the macro style class method called from the AR model
11
+ def auto_hash(*args)
12
+
13
+ # Create a setter and "comparer" for each arg
14
+ args.each do |field_name|
15
+
16
+ # Dynamically define a new setter
17
+ define_method "#{field_name}=" do |value|
18
+
19
+ value = AutoHashBuilder.auto_hash_create(value)
20
+
21
+ # write_attribute() is the documented way to write to a AR
22
+ # field after you've overridden the setter,
23
+ # http://ar.rubyonrails.org/classes/ActiveRecord/Base.html
24
+ write_attribute(field_name, value)
25
+
26
+ end
27
+
28
+ # Dynamically define the "comparer"
29
+ define_method "#{field_name}_hash_match?".to_sym do |match|
30
+ existing = send(field_name)
31
+ value = AutoHashBuilder.auto_hash_compare(existing, match.to_s)
32
+ end
33
+
34
+ end
35
+
36
+ end
37
+
38
+ # This nested class is here only to avoid exposing the autohash
39
+ # inner api to the AR model. It has no other excuse to be a class.
40
+ class AutoHashBuilder
41
+
42
+ class << self
43
+
44
+ def auto_hash_create(value)
45
+ salt = ActiveSupport::SecureRandom.hex(10)
46
+ hash = create_hash(value, salt)
47
+ "#{hash}-#{salt}"
48
+ end
49
+
50
+ def auto_hash_compare(hash, value)
51
+ salt = extract_salt_part(hash)
52
+ hash_old = extract_hash_part(hash)
53
+ hash_new = create_hash(value, salt) # try to recreate same hash
54
+ hash_new == hash_old
55
+ end
56
+
57
+ private #~*~*~*~*~*~*~*~*~*~*
58
+
59
+ def create_hash(value, salt)
60
+ Digest::SHA2.new.update(value + salt).to_s
61
+ end
62
+
63
+ def extract_hash_part(hash)
64
+ hash.split(/-/)[0]
65
+ end
66
+
67
+ def extract_salt_part(hash)
68
+ hash.split(/-/)[1]
69
+ end
70
+
71
+ end # << class << self
72
+
73
+ end
74
+
75
+ #send :include, InstanceMethods
76
+
77
+ end
78
+
79
+ # module InstanceMethods
80
+ # end
81
+
82
+ end
83
+
84
+
85
+ ActiveRecord::Base.send :include, AutoHash
data/log/test.log ADDED
File without changes
@@ -0,0 +1,59 @@
1
+ require 'test_helper'
2
+
3
+ # Note: all these test depend on "autotest :password" being in the User model
4
+
5
+ class UserTest < ActiveSupport::TestCase
6
+
7
+ test "simple instantiation" do
8
+
9
+ @user = User.new(:username => "kevin", :password => "asdf")
10
+ assert @user
11
+
12
+ end
13
+
14
+ # We can't exactly test if the new password is a correctly hashed
15
+ # password until running the comparer method, but we can check if
16
+ # its nil or blank, or its not still the clear text password - which
17
+ # would be quite a bug.
18
+ test "password hashed" do
19
+
20
+ original_password = "asdf"
21
+ @user = User.new(:username => "kevin", :password => original_password)
22
+
23
+ assert_equal "kevin", @user.username # make sure other fields untouched
24
+ assert_not_equal nil, @user.password
25
+ assert_not_equal "", @user.password
26
+ assert_not_equal original_password, @user.password
27
+
28
+ end
29
+
30
+ # Finally test the comparer method
31
+ test "matching" do
32
+
33
+ original_password = "asdf"
34
+ @user = User.new(:username => "kevin", :password => original_password)
35
+
36
+ assert @user.password_hash_match?(original_password)
37
+ assert ! @user.password_hash_match?("banana")
38
+ assert ! @user.password_hash_match?("")
39
+ assert ! @user.password_hash_match?(nil)
40
+
41
+ end
42
+
43
+ # Test whole circuit, including writing and reading from database.
44
+ test "write, find, match" do
45
+
46
+ original_password = "asdf"
47
+ @user = User.new(:username => "kevin", :password => original_password)
48
+ @user.save
49
+
50
+ user = User.find_by_username("kevin")
51
+
52
+ assert user.password_hash_match?(original_password)
53
+ assert ! user.password_hash_match?("banana")
54
+ assert ! user.password_hash_match?("")
55
+ assert ! user.password_hash_match?(nil)
56
+
57
+ end
58
+
59
+ end