Factorization for reuse AES mode
Brissouille opened this issue · comments
If the code is factorizable in reusing the init of the variables, then we implement only the functions of chainning (= xor plain with iv) and call them in function of mode chosen.
Factorization is in progress. All the variables subject to the initialization of the AES mode are in the function init_mode.
Questions:
Do I build a dictionary with different functions init_mode for each AES mode ?
Do I build a class AES_.... for each mode and give a mother abstract class AES_Mode. Only one function must be implemented (ie init_mode).
I choose to build a class AES_mode where each Aes mode (example cbc) will be a daughter class. Then I implement the function init_mode for each mode.
Aes_mode class will be an abstract class.