Implementations of JavaScript stream ciphers?
Are there any free to use implementations of stream ciphers available for JavaScript?
Especially interested in HC-128, Salsa20/12 or SOSEMANUK as these are 开发者_如何学Gorecommended by The eSTREAM Project
Section D of Symmetric Cryptography in Javascript refers to a "Javascript implementation of Salsa20/12" but I can't find the implementation on their github repo.
We compared Javascript AES with a Javascript implementation of Salsa20/12 [20], one of the fastest eSTREAM ciphers. A native x86 implementation of Salsa20/12 is about 5 times faster than a native implementation of 128-bit AES. Surprisingly, Table VII shows that when both algorithms are implemented in Javascript, Salsa 20/12 is comparable in speed to AES. We believe that this discrepancy is primarily due to Javascript’s lack of 128-bit SIMD instructions or of 64-bit registers, and secondarily due to Salsa20/12’s larger state spilling to memory.
This is the version Kevin Hakanson was referring to: https://gist.github.com/dchest/4126510 . It has a pretty decent I/O throughput (110MB/s), and seems to follow the spec to the letter. I have not, however, tested it, as I have no reference to test it against besides looking at the ops and compare them to the RFC...so use at your own risk!
I'm not sure about any JavaScript implementations of those, but if you have a serverside implementation, you can think about sending it to your server via an ajax request (over https) and getting the result as the response. :)
精彩评论