[Cryptography Team] [ENH] AES

Joshua Gargus schwa at fastmail.us
Sat Nov 25 06:58:19 UTC 2006


On Nov 24, 2006, at 10:25 PM, Cerebus wrote:

> On 11/24/06, Joshua Gargus <schwa at fastmail.us> wrote:
>> It seems like a good idea to refactor as a single class.  However,
>> even with a single class that can handle multiple key sizes, it seems
>> redundant to have a #keySize: method, when the size of the key can be
>> easily determined in #key: .  It would make sense to make this change
>> in Rijndael, and have AES inherit it.
>
> I *just* posted a refactoring.
>
>> With respect to #blockSize:, it might be better to throw an exception
>> (eg: 'AES does not support multiple block sizes; use Rijndael
>> instead') so that the user is educated, rather than assuming that the
>> method does something when it really doesn't.
>
> Good point.  I guess I'll have to go learn exceptions now.

Easy.  Just make a new subclass of Error, perhaps ImproperCipherUse,  
and then override #blockSize: to signal it:

blockSize: aNumber
	ImproperCipherUse signal: 'AES does not support multiple block  
sizes; use Rijndael instead'

Josh


> Tomorrow.
> Err, today.  In the morning--wait.  After some sleep.  :)

:-)

Josh

>
> -- Tim
> _______________________________________________
> Cryptography mailing list
> Cryptography at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/ 
> cryptography



More information about the Cryptography mailing list