-
-
Notifications
You must be signed in to change notification settings - Fork 198
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace md5 with sha256 to work on FIPS machines (#814)
- Loading branch information
1 parent
1947842
commit 698241a
Showing
2 changed files
with
4 additions
and
4 deletions.
There are no files selected for viewing
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,8 +1,8 @@ | ||
import { hash } from "./hash"; | ||
|
||
test("should return a hash", () => { | ||
test("should return a consistent hash", () => { | ||
const str = "Hello, world!"; | ||
|
||
expect(hash(str)).toBe("6cd3556deb0da54bca060b4c39479839"); | ||
expect(hash(str)).toBe("6cd3556deb0da54bca060b4c39479839"); | ||
expect(hash(str)).toBe("315f5bdb76d078c43b8ac0064e4a0164612b1fce77c869345bfc94c75894edd3"); | ||
expect(hash(str)).toBe("315f5bdb76d078c43b8ac0064e4a0164612b1fce77c869345bfc94c75894edd3"); | ||
}); |
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,5 +1,5 @@ | ||
import crypto from "crypto"; | ||
|
||
export function hash(str: string): string { | ||
return crypto.createHash("md5").update(str).digest("hex"); | ||
return crypto.createHash("sha256").update(str).digest("hex"); | ||
} |