ohash icon indicating copy to clipboard operation
ohash copied to clipboard

feat(crypto): re-added `sha256()` function

Open zsilbi opened this issue 8 months ago • 2 comments

Issue https://github.com/unjs/ohash/issues/156

Re-added the sha256 hex function:

import { sha256 } from "ohash/sha256";

// "a591a6d40bf420404a011733cfb7b190d62c65bf0bcda32b57b277d9ad9f146e"
console.log(sha256("Hello World"));

Added back the tests for the js/node implementations. Updated README accordingly.

zsilbi avatar Apr 16 '25 08:04 zsilbi

Thanks for splitting PR. Can you try to minimize changes? adding back hex should not required this much (if no success no worry i try later)

pi0 avatar Apr 16 '25 08:04 pi0

Thanks for splitting PR. Can you try to minimize changes? adding back hex should not required this much (if no success no worry i try later)

I did not want to import from js/crypto/index.ts to js/crpto/sha256.ts, that's why I moved the classes to their original location (_core.ts) so I can use these in both export locations.

I can move those back to index.ts but it looks weird to me.

zsilbi avatar Apr 16 '25 08:04 zsilbi