/// <summary> /// Use this constructor to manually set the functions on the encryption /// enc.CustomOp = rbjd.Forward; /// enc.ReverseOp = rbjd.Reverse; /// </summary> /// <example> /// var rbjd = new RandomBijectionDecorator(enc.Alphabet) /// enc.InitializeBijection(rng); /// enc.CustomOp = rbjd.Forward; /// enc.ReverseOp = rbjd.Reverse; /// </example> /// <param name="alph"></param> public RandomBijection(char[] alph) { _Encrypt = new NullCypher(); _Encrypt.Alphabet = alph; Alphabet = alph; ModulateKey = true; }
public static char[] GetPowerOf2Alphabet() { var alpha = AlphabeticCypher.GetSimpleAlphabet(false); var powOf2Alphabet = new List <char>(alpha); powOf2Alphabet.AddRange(new char[] { 'A', 'H', 'B', 'W', 'N' }); return(powOf2Alphabet.ToArray()); }
/// <summary> /// Use this constructor as an Decorator to the encryption that allows a custom operation. /// This will generate a random bijection so the attacker wont know whether xor or + is being used. /// </summary> /// <param name="enc"></param> public RandomBijection(AlphabeticCypher enc) { _Encrypt = enc; Alphabet = enc.Alphabet; ModulateKey = true; }