Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JavaScript Encrypt?

How to hash/encrypt string value in JavaScript? I need a mechanism to do so for hiding some data in localStorage/cookie?

It is something related to security concern but I want some protection for my data.

like image 885
Deepak Biswal Avatar asked Aug 07 '13 20:08

Deepak Biswal


1 Answers

There are lots of encryption libraries for javascript. Here's the first one that came up on Google: http://crypto.stanford.edu/sjcl/

Your user can always gain access to the key, so this won't protect data from your user. If you want to hide things from the user, you'll have to encrypt it on the server and never send the key to the client.

like image 61
Trevor Dixon Avatar answered Oct 24 '22 05:10

Trevor Dixon