public bool TestSubstitutionBreak()
        {
            Substitution sub = new Substitution(cipher: "OFPNWOPZWRONSWRLQSLLPINROPHZSIZRBBNWIQSWOPKONKRWRWWYRLQSBHPONONUPHZSIZRBBNWIQSBHPONONSWRBSWIOFPYWNUPZKNONPKSGOFPDSZLE");

            (var plain, var prob) = sub.Break();
            Print(sub.Cipher, sub.Key, plain, prob);
            return(plain == "the international collegiate programming contest is an annual competitive programming competition among the universities of the world");
        }
        public bool TestSubstitutionDecode()
        {
            Substitution sub = new Substitution(cipher: "OFPNWOPZWRONSWRLQSLLPINROPHZSIZRBBNWIQSWOPKONKRWRWWYRLQSBHPONONUPHZSIZRBBNWIQSBHPONONSWRBSWIOFPYWNUPZKNONPKSGOFPDSZLE");

            (var plain, _) = sub.Decode();
            Print(sub.Cipher, sub.Key, plain);
            return(plain == "HELLO hello");
        }
        public bool TestSubstitutionEncode()
        {
            Substitution sub = new Substitution(plain: "the international collegiate programming contest is an annual competitive programming competition among the universities of the world");

            sub.Key         = sub.GenerateKey();
            (var cipher, _) = sub.Encode();
            Print(sub.Plain, sub.Key, cipher);
            return(cipher == "WNIIR wniir");
        }
예제 #4
0
 public IGA(Substitution sub)
 {
     this.sub = sub;
 }
예제 #5
0
 public IGA(Substitution sub)
 {
     this.sub = new Substitution(sub.Plain, sub.Cipher, sub.Key);
 }