简体   繁体   中英

Hash text in Chrome Extension

I need to hash some values in chrome extension(sha256 and ripemd160 with key).

I can't use PHP to do it, JS doesn't have build in function to do it. Only solution I see is to send a request to server and recieve hash or insert liblary with hash function to my project, which is maybe possible.

What's the best way to hash values in Chrome Extensions and how to do it?

crypto-js is simple liblary that let us hash text in JS. You just need to download correct algorythm .js file.

Then you simply link it to your project and use like that:

part1 = CryptoJS.HmacSHA256(textToHash, key);
part2 = CryptoJS.HmacRIPEMD160(textToHash, key);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM