예제 #1
0
 private byte[] SubByte(byte[] newKeyScheduler)
 {
     for (var i = 0; i < newKeyScheduler.Length; i++)
     {
         newKeyScheduler[i] = SBox.Replace(newKeyScheduler[i].ToString("X2"));
     }
     return(newKeyScheduler);
 }
예제 #2
0
 public void SubBytes()
 {
     for (var i = 0; i < 4; i++)
     {
         for (var j = 0; j < 4; j++)
         {
             this.crifredText.matrix[i, j] = SBox.Replace(this.crifredText.matrix[i, j].ToString("X2"));
         }
     }
 }
예제 #3
0
        public static byte Replace(string bte)
        {
            if (sboxSingleton == null)
            {
                SBox.sboxSingleton = new SBox();
            }
            var byteStr = bte.ToCharArray();

            return(SBox.sboxSingleton.sbox[Convert.ToInt32(byteStr[0].ToString(), 16), Convert.ToInt32(byteStr[1].ToString(), 16)]);
        }