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

Frequently asked questions

  Why might I use Crypt?

If you want to use encryption and you can rely on ruby being installed but cannot depend on an external library being installed, then you may find Crypt useful. You might not be able to depend on an external library (such as OpenSSL) because you do not have access to install it, or because you are considering deploying to many different platforms and do not want to manage all the different versions of the external library.
For me, flexibility of deployment was more important than performance for occasional use.

  When should I not use Crypt?

When you really want high performance. Being pure-ruby, the performance is what you would expect. If the message volume is high or the message size is large and performance is critical, then you would probably be much better off with some optimized C. Check out AESCrypt and OpenSSL for Ruby.

  Does this work for unicode?

Yes it does, but you have to take care of setting the desired encoding. When you provide a unicode string, it is automatically converted into 8-bit ascii for purposes of encryption (we need to deal with bytes). But when you decrypt, you will get an 8-bit ascii string and if you want unicode, you will need to force the encoding like this:

decrypted = decrypted.force_encoding("UTF-8")

  Why don't you spell cipher properly?

I'm Australian and we spell like that (that is, correctly ;-)
Yeah, I know, its a feeble attempt to preserve my cultural identity while I live and work in the US.

  Do you know what a Feistel network is?

Me? uh...not really. Despite a degree in Pure Mathematics from many years ago (I vaguely remember something about Eigenvectors) I don't really know much about cryptography. If you've read the wikipedia links for each cypher then you probably know more about cryptography than I do. If you've understood them, then you definitely know more than I do.