JSCrypto — Fast symmetric cryptography in Javascript
crypto.stanford.edu
crypto.stanford.edu
Our approach. In our Javascript implementation we propose
a different approach that keeps the code small and speeds up
encryption/decryption. Instead of embedding tables in the
code, our library contains code that precomputes all tables
on the browser before encryption or decryption begins. Since
code to precompute the tables is much smaller than the tables
themselves, we keep the library size small. We reap the benefits
of precomputed tables by quickly building the tables on the
browser before the first encryption. The only values we hardcode
are the 10 round constants, which are 28 bytes total.
Precomputing the tables takes about 0.8ms on Google Chrome and about 8ms
on Internet Explorer 8. Because this saves several KB of code,
it is nearly as fast to precompute the AES tables as it would
be to load them from disk. Moreover, computing the tables in
the browser is far faster than downloading them over the network.
Amazing implementation.* In online Internet applications, it can only be delivered safely on pages for which every resource is delivered over HTTPS. Most developers aren't going to see the point of using both HTTPS and JSCrypto. The ones who choose simply to use JSCrypto have totally insecure applications.
* For the task of creating applications with Tarsnap-like insulation between the server and customer data (ie, a backup system where the server can't read your data), this library won't work; any application that delivers this library can in a myriad of subtle and undetectable ways sabotage its security.
The reason why data is encrypted is that database theft (e.g. backup theft) is not a disclosure of data.
Whether developer himself is malicious or his auto-update is hacked, it's a vector to inject harmful code to the user-side environment.
Statistically, there is no practical difference in security of the user's data between a native app and a web app.
http://github.com/markpercival/gibberish-aes
The advantage of mine is that it's fully OpenSSL compatible and plenty fast. 20k of text on Chrome take .064 seconds to decode and encode.
But I love the idea of compile on load, might have to steal it :)
Which is not to say that getting to this point is not an achievement; JavaScript isn't exactly the best language to implement cryptographic algorithms in.
It feels weird that these days when I am trying out some fun projects or algorithms, I prefer using JavaScript to build a prototype if possible. JavaScript is fast enough for my small computing needs & It does not require anything else to run other than a browser.
WebSockets, HTML5 (Canvas + Web Storage etc)... Really exciting.
Sorry JSCrypto team, while your implementation is awesome and all, you are doing it wrong.
Though its probably best to use C wrappers to established crypto libraries on the server side, we shouldn't underestimate the ease of use which comes with using pure javascript libraries.
In the meantime, serverside Javascript as a rule has access to better native AES code. The browser definitely seems like the motivating use case here.