bun icon indicating copy to clipboard operation
bun copied to clipboard

support shake256 algo

Open lukeed opened this issue 2 years ago • 1 comments

What version of Bun is running?

1.0.2+37edd5a6e389265738e89265bcbdf2999cb81a49

What platform is your computer?

Darwin 21.3.0 arm64 arm

What steps can reproduce the bug?

// demo.ts
import { createHash } from 'node:crypto';

console.log(
	createHash('shake256').update('hello').digest('hex').substring(0, 32)
);

What is the expected behavior?

$ tsm demo.ts
# 1234075ae4a1e77316cf2d8000974581

What do you see instead?

$ bun run demo.ts
# [0.08ms] ".env"
# 1051 |     }, module.exports = CipherBase;
# 1052 |   }
# 1053 | }), require_browser2 = __commonJS({
# 1054 |   "node_modules/create-hash/browser.js"(exports, module) {
# 1055 |
# 1056 |     const LazyHash = function Hash(algorithm, options) {
#                                                                       ^
# TypeError: Unsupported algorithm shake256
#  code: "ERR_INVALID_ARG_TYPE"
#
#      at new Hash (node:crypto:1056:68)
#      at createHash (node:crypto:1175:80)
#      at /Users/.../demo.ts:3:1

Additional information

No response

lukeed avatar Oct 08 '23 04:10 lukeed

The node:crypto module hasn't been implemented yet. Unless I'm behind from the last couple versions

Edit: Scratch that. I am behind. It has been implemented

alekcunn avatar Oct 11 '23 04:10 alekcunn