Skip to content

Commit

Permalink
add comment
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 committed Feb 20, 2025
1 parent ac7b91e commit 1e72f02
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/crypto/node/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import { createHash, hash } from "node:crypto";
*/
export function digest(data: string): string {
if (hash) {
// Available in Node.js v21.7.0+, v20.12.0+
// https://nodejs.org/api/crypto.html#cryptohashalgorithm-data-outputencoding
return hash("sha256", data, "base64url");
}
return createHash("sha256").update(data).digest("base64url");
Expand Down

0 comments on commit 1e72f02

Please sign in to comment.