From: Josh Cheek Date: 2010-07-02T00:44:42+09:00 Subject: Re: New AES gem available -- fast-aes --0016e6d7eeb422bf4c048a5559fd Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable 2010/7/1 P=E5l Bergstr=F6m > I should add that I don't fully understand this thing with encryption > and the terminology. Could you explain a bit the key length and 128 bit? > Is it always the length as in your example? > > Empirically yes: require 'rubygems' require 'fast-aes' require 'pp' key , results =3D String.new , Array.new for char in [*'a'..'z'] + [*'A'..'H'] results << begin FastAES.new key and "Valid: #{key}" rescue =3D> error error end key << char end pp results Definitively (fast_aes.c), still yes: key_bits =3D strlen(key_data)*8; switch(key_bits) { case 128: case 192: case 256: fast_aes->key_bits =3D key_bits; memcpy(fast_aes->key, key_data, key_bits/8); /*printf("AES key=3D%s, bits=3D%d\n", fast_aes->key, fast_aes->key_bits);*/ break; default: sprintf(error_mesg, "AES key must be 128, 192, or 256 bits in lengt= h (got %d): %s", key_bits, key_data); rb_raise(rb_eArgError, error_mesg); return Qnil; } --0016e6d7eeb422bf4c048a5559fd--