0

I need to hash string in angular 2+ with SHA512, but i couldn't find any library or function to do that. Do you know of any solution to that?

2
  • You can use this package with angular. * npmjs.com/package/sha256 Commented Jul 4, 2018 at 10:49
  • @PardeepJain: SHA256 != SHA512. Commented Jul 4, 2018 at 11:43

1 Answer 1

3

Ok, i found the solution. I installed this npm package

then I included this package into my service (you can include it in component or wherever you need it) like that

import * as sha512 from 'js-sha512';

and finally used it as it says in documentation like that:

sha512.sha512('Message to hash');

The library has to be used to get to the function provided by it.

Sign up to request clarification or add additional context in comments.

1 Comment

Note you can use it with: import { sha512 } from 'js-sha512'; And then, create your hash like this: sha512.create().update(<something_to_hash>).hex()

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.