bun
bun copied to clipboard
crypto.hash is not a function?
What version of Bun is running?
1.1.30+7996d06b8
What platform is your computer?
Darwin 24.0.0 arm64 arm
What steps can reproduce the bug?
import crypto from 'node:crypto';
const hash = crypto.hash('sha256', 'test', 'hex');
console.log(hash);
What is the expected behavior?
9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08
What do you see instead?
1 | import crypto from 'node:crypto'; 2 | 3 | const hash = crypto.hash('sha256', 'test', 'hex'); ^ TypeError: crypto.hash is not a function. (In 'crypto.hash("sha256", "test", "hex")', 'crypto.hash' is undefined) at /Users/xxx/test/index.ts:3:21
Bun v1.1.30 (macOS arm64)
Additional information
No response