-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #182 from SeasideSt/secureHash-test
Expanded the testcase for GRPlatform>>secureHashFor:
- Loading branch information
Showing
1 changed file
with
13 additions
and
3 deletions.
There are no files selected for viewing
16 changes: 13 additions & 3 deletions
16
repository/Grease-Tests-Core.package/GRPlatformTest.class/instance/testSecureHashFor.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,19 @@ | ||
tests | ||
testSecureHashFor | ||
"Make sure the platform class provides a #secureHashFor: method. The method is called by Seaside when hashing passwords. The Squeak implementation returns a SHA-1 hash but another equivalent hash method could also be used." | ||
"Make sure the platform class provides a #secureHashFor: method. The method is called by Seaside when hashing passwords. | ||
The Pharo implementation returns a SHA-1 hash but another equivalent hash method could also be used." | ||
|
||
| a b | | ||
| a b c d invalidUtf8 e f | | ||
a := self platform secureHashFor: 'foobar'. | ||
b := self platform secureHashFor: 'foobar'. | ||
self assert: a equals: b. | ||
|
||
c := self platform secureHashFor: #[102 111 111 98 97 114]. | ||
d := self platform secureHashFor: #[102 111 111 98 97 114]. | ||
self assert: c equals: d. | ||
|
||
self assert: (a = b) | ||
"The following ensures any byte array can be used (and not only the onces containing valid utf8)" | ||
invalidUtf8 := #[160 161]. | ||
e := self platform secureHashFor: invalidUtf8. | ||
f := self platform secureHashFor: invalidUtf8. | ||
self assert: e equals: f |