Rijndael
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.

Rijndael (AES)

Rijndael (pronounced Rain-dahl) is a block cipher, developed by Joan Daemen and Vincent Rijmen in 1997. This implementation allows for an independent choice in both block and key sizes of 16, 24, or 32 bytes.

Rijndael was selected as the Advanced Encryption Standard (AES), the difference is that the AES specification allows no choice in the block size of 16 bytes.

In practise, no effective attacks against Rijndael have been found. It is secure and fast, and freely available for use.

This implementation was adapted from the reference ANSI C code by Paulo Barreto and Vincent Rijmen.

require 'crypt/rijndael'
rijndael = Crypt::Rijndael.new("A key 16, 24, or 32 bytes length")
plainBlock = "ABCDEFGH12345678"
encryptedBlock = rijndael.encrypt_block(plainBlock)
decryptedBlock = rijndael.decrypt_block(encryptedBlock)

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