Skip to content

Commit 845da38

Browse files
authored
Merge pull request #6404 from liranmauda/liran-HashWrap-sha1
Adding wrap for SHA1
2 parents f6081ed + 7e2def7 commit 845da38

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/util/fips.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,16 @@ function create_hash_md5_mb() {
5757
return wrap;
5858
}
5959

60+
/**
61+
* @returns {crypto.Hash}
62+
*/
63+
function create_hash_sha1_mb() {
64+
const { SHA1_MB } = nb_native();
65+
const wrap = new HashWrap(new SHA1_MB());
66+
// @ts-ignore
67+
return wrap;
68+
}
69+
6070
/**
6171
* @param {string} algorithm
6272
* @param {object} options
@@ -66,6 +76,8 @@ function create_hash_fips(algorithm, options) {
6676
switch (algorithm) {
6777
case 'md5':
6878
return create_hash_md5_mb();
79+
case 'sha1':
80+
return create_hash_sha1_mb();
6981
default:
7082
return original_crypto.createHash(algorithm, options);
7183
}

0 commit comments

Comments
 (0)