示例#1
0
文件: RoundKey.cs 项目: flpnslm/SSAES
 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
文件: SBox.cs 项目: flpnslm/SSAES
        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)]);
        }