symetric encryption with key for javascript and ruby -


I want to encode a number which will be 10 digits long by key with ASCII characters.

The encoded string should be decodable with the same key, which should return the decoded number.

  10 = & gt; Encoding_digit ("secret_pass") = & gt; Hash = & gt; Decoding_with ("secret_pass") = & gt; 10   

Both tasks should work in JavaScript and Ruby in a similar way.

Which algorithm should I use for this purpose?

All data should be in ASCII, no multibyte data for input, hash and key.

Should be a simple XOR is enough. Yes, you can go overboard and break the complete crypto suite, but since part of the algorithm will run in-browser, JS ( In a completely unreal environment), any attempt on serious cryptography will give you one (in other words, in fact, your system will less secure).

If you are trying to protect the data in transit, use the tool for the job; In this case, HTTPS.

Comments

Popular posts from this blog

mysql - BLOB/TEXT column 'value' used in key specification without a key length -

memcached - Django cache performance -