sha256 icon indicating copy to clipboard operation
sha256 copied to clipboard

Deprecated

Open narayananramu opened this issue 7 years ago • 5 comments

Hi

I am interested to carry this project further. I having using the module for more than a year now, I don't find a easy alternative for this library.

narayananramu avatar Apr 12 '17 13:04 narayananramu

Hi @narayananramu why not use either Node.js crypto or https://www.npmjs.com/package/create-hash?

jprichardson avatar Apr 12 '17 16:04 jprichardson

@jprichardson because

sha256('sss')

is easier than

hash.update('synchronous write'); hash.digest();

narayananramu avatar Apr 15 '17 18:04 narayananramu

update is chainable method createHash('sha256').update(Buffer).digest() is valid code

fanatid avatar Apr 15 '17 18:04 fanatid

@fanatid also

sha256.x2('string');

is easier than

createHash('sha256').update(createHash('sha256').update('string').digest()).digest()

narayananramu avatar Apr 15 '17 18:04 narayananramu

just write a one-line wrapper in your own code and call it a day, even safer because it's your own layer of abstraction now:

const hash = (payload: string): string => createHash('sha256').update(createHash('sha256').update('string').digest()).digest();

hijarian avatar Aug 21 '24 07:08 hijarian