Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documented example usage of Node API crypto.hash method throws TypeError as .hash() is undefined #987

Open
noelforte opened this issue Oct 11, 2024 · 0 comments

Comments

@noelforte
Copy link

Possibly related: denoland/deno#24945

Implementation and example usage of the .hash() method from node:crypto is a documented part of Deno's Node-compatible API.

However, attempting to run the following example throws an error:

import crypto from 'node:crypto';
import { Buffer } from 'node:buffer';

// Hashing a string and return the result as a hex-encoded string.
const string = 'Node.js';
// 10b3493287f831e81a438811a1ffba01f8cec4b7
console.log(crypto.hash('sha1', string));
~/Desktop => deno crypto-hash.ts
error: Uncaught (in promise) TypeError: crypto.hash is not a function
console.log(crypto.hash('sha1', string));
                   ^
    at file:///.../Desktop/crypto-hash.ts:7:20

Documented features should be supported or removed from the documentation until actually implemented.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant