This a wider question than my previous one but related.
I want to implement oldish crypto systems in Ruby such as ADFGVX, VIC cipher and others, mostly for fun. These cryptosystems are built on top of more general systems like substitution (monoalphabetic such as Caesar or polyalphabetic like Vigenere) and transposition (simple, double). My question is really how would you create a hierarchy of classes to handle both cryptosystems and keys.
Something like Vigenere < Substitution < SimpleCipher or something else? How about keys? Some substitution keys are condensed before use ("ARABESQUE" becomes "ARBESQU") whereas most transposition keys are not and so on.
Right now, I have a very basic design doc (I said basic) and as I think about it, I can't seem find a satisfying way for this, so I come here for your wisdom.
Implementation will be in Ruby but unless the design must use multiple inheritance, it is not about Ruby itself.
Proof of concept (not yet runnable and possibly wrong) here in Mercurial.
Thanks.