-2

Should I use npm package like crypto-js ?

String hash = "Something" ;
hash = (new sun.misc.BASE64Encoder()).encode(sha.digest(hash.getBytes()));

Edit:

Suggestions led to different results. I have found the solution as below on server side with nodejs:

const crypto = require('crypto');
const hashStr = "Something different";
let sha = crypto.createHash('sha1');
sha.update(hashStr);
let shaBase64 = sha.digest('base64');

console.log(shaBase64);
0

1 Answer 1

0

You can use the window.btoa function for that.

btoa('Something');
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.