The library allows addition, subtraction, multiplication, division, exponentiation, and inverses modulo an arbitrary number.
It has the extended Euclid algorithm, and can convert between bases up to base 95.
It can generate both true prime numbers and probable primes (which have a probability less than 2^-80 of being composite).
It uses the built-in JavaScript random number generator, which must be replaced for any crypto or security application.
It will run faster on a browser with a good JavaScript compiler. As of 2009,
that means Microsoft Internet Explorer is slow, but all the other major browsers are fast
(Firefox, Safari, Chrome, Opera).
It's hard to imagine any practical cryptographic use for this code, other than pedagogical.
As of 2009, the major browsers give
warning messages if it runs more than a few seconds.
A web page is susceptible to Man In The Middle (MITM) attacks. A MITM can
modify a web page as it's downloading, inserting code to capture passwords etc. as they're
typed, and send them back to the MITM. Even SSL adds little security, since users ignore
certificate warnings.
This page was
just written for my entertainment, after seeing a
request for something like this on sci.crypt.