|
|
This a Javascript implementation of Bruce Schneier's Blowfish encryption algorithm.
Feedback of any sort is welcome to blowfish@nklein.com
There are a few Javascript files available here:
blowfish.js This file implements the Blowfish algorithm. The
_encrypt_block() and _decrypt_block()
methods take an array of two 32-bit numbers and replace
those numbers with the encrypted/decrypted values. The
encrypt_block() method takes an array of eight
8-bit integers which are assembled into the two 32-bit
numbers to be fed to the _encrypt_block()
method and places the result back into the input array.
blowfish-test.js This file has one function StandardBlowfishTests()
which runs the Blowfish implementation against the 58 standard
test vectors. Note: on slower machines, this can take quite some
time. If your browser asks you to continue or stop the script,
you should continue.
cfb-stream.js This file implements a class CFBStream which
takes any block cipher that supports an encode_block()
method and a BLOCKSIZE property like the Blowfish
algorithm above does and turns it into a Cipher Feedback
Stream.
Note: the CFBStream is stateful. So, to decrypt,
you need to start it with the same initial vector iv
that you started the encrypting with.