@@ -167,6 +167,11 @@ describe("isHashMatch", () => {
167
167
const _hash = hash ( password )
168
168
expect ( isHashMatch ( "otherPassword123" , _hash ) ) . toBe ( false )
169
169
} )
170
+ it ( "should return true with actual hash" , ( ) => {
171
+ const password = "password"
172
+ const _hash = "$2b$10$GA/eZnlboeV9eW8LnntPqe1dZE7tQ/./wCdc7NgJhMRB.xhaJfmG."
173
+ expect ( isHashMatch ( password , _hash ) ) . toBe ( true )
174
+ } )
170
175
} )
171
176
172
177
describe ( "hashLegacy" , ( ) => {
@@ -177,7 +182,7 @@ describe("hashLegacy", () => {
177
182
} )
178
183
} )
179
184
180
- describe ( "isHashLegacyMatchh " , ( ) => {
185
+ describe ( "isHashLegacyMatch " , ( ) => {
181
186
it ( "should return true if is match" , ( ) => {
182
187
const password = "password123"
183
188
const _hash = hashLegacy ( password )
@@ -188,4 +193,10 @@ describe("isHashLegacyMatchh", () => {
188
193
const _hash = hashLegacy ( password )
189
194
expect ( isHashLegacyMatch ( "otherPassword123" , _hash ) ) . toBe ( false )
190
195
} )
196
+ it ( "should return true if hashed from command line" , ( ) => {
197
+ const password = "password123"
198
+ // Hashed using printf "password123" | sha256sum | cut -d' ' -f1
199
+ const _hash = "ef92b778bafe771e89245b89ecbc08a44a4e166c06659911881f383d4473e94f"
200
+ expect ( isHashLegacyMatch ( password , _hash ) ) . toBe ( true )
201
+ } )
191
202
} )
0 commit comments