diff options
| author | 2023-04-27 15:45:32 +0100 | |
|---|---|---|
| committer | 2023-04-27 07:45:32 -0700 | |
| commit | 0060e499235a88693d2b884f5067afa9d4a5793f (patch) | |
| tree | 97d0977e6355c796a430d152d1a73746963cbebb /src/bun.js/crypto.exports.js | |
| parent | 87921520e45a2c8e44ab7dc844da2641a83bd164 (diff) | |
| download | bun-0060e499235a88693d2b884f5067afa9d4a5793f.tar.gz bun-0060e499235a88693d2b884f5067afa9d4a5793f.tar.zst bun-0060e499235a88693d2b884f5067afa9d4a5793f.zip | |
fix: make node:crypto Hash.copy work correctly (#2761)
This commit will also:
- add a CryptoHasher.copy function
- make CryptoHasher.digest reset the hasher so it can be reused
Resolves #2651
Diffstat (limited to 'src/bun.js/crypto.exports.js')
| -rw-r--r-- | src/bun.js/crypto.exports.js | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/bun.js/crypto.exports.js b/src/bun.js/crypto.exports.js index 4001179e8..95e6674e8 100644 --- a/src/bun.js/crypto.exports.js +++ b/src/bun.js/crypto.exports.js @@ -1182,7 +1182,9 @@ var require_browser2 = __commonJS({ } copy() { - return new CryptoHasher(this.#algorithm); + const copy = new Hash(this.#algorithm); + copy.#hasher = this.#hasher.copy(); + return copy; } } |
