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?