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);