Skip to content

Commit 698241a

Browse files
Replace md5 with sha256 to work on FIPS machines (#814)
1 parent 1947842 commit 698241a

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { hash } from "./hash";
22

3-
test("should return a hash", () => {
3+
test("should return a consistent hash", () => {
44
const str = "Hello, world!";
55

6-
expect(hash(str)).toBe("6cd3556deb0da54bca060b4c39479839");
7-
expect(hash(str)).toBe("6cd3556deb0da54bca060b4c39479839");
6+
expect(hash(str)).toBe("315f5bdb76d078c43b8ac0064e4a0164612b1fce77c869345bfc94c75894edd3");
7+
expect(hash(str)).toBe("315f5bdb76d078c43b8ac0064e4a0164612b1fce77c869345bfc94c75894edd3");
88
});
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import crypto from "crypto";
22

33
export function hash(str: string): string {
4-
return crypto.createHash("md5").update(str).digest("hex");
4+
return crypto.createHash("sha256").update(str).digest("hex");
55
}

0 commit comments

Comments
 (0)