Crypt  :: pure-ruby cryptographic cyphers

The Crypt library is a pure-ruby implementation of a number of popular encryption algorithms. Block cyphers currently available include Blowfish, GOST, IDEA, and Rijndael (AES). Cypher Block Chaining (CBC) has been implemented.

Crypt is written entirely in ruby so deployment is simple - no platform concerns, no library dependencies, nothing to compile.


Blowfish is a keyed, symmetric block cipher, designed in 1993 by Bruce Schneier. The block size is 8 bytes, and the key may be anywhere from 4 to 56 bytes. It is a Feistel network of 16 rounds. In practise, no effective attacks against Blowfish have been found. It is secure and fast, and freely available for use.

This implementation was adapted from Bruce Schneier's reference C code.

require 'crypt/blowfish'
blowfish ="A key up to 56 bytes long")
plainBlock = "ABCD1234"
encryptedBlock = blowfish.encrypt_block(plainBlock)
decryptedBlock = blowfish.decrypt_block(encryptedBlock)

To encrypt files, see the section on Cypher Block Chaining.