Beispiel #1
0
        public static void InvSubBytes(byte[] state)
        {
            CheckState(state);

            SBox sBox = SBox.GetInstance();

            for (int i = 0; i < state.Length; i++)
            {
                state[i] = sBox.InvSubstitute(state[i]);
            }
        }
Beispiel #2
0
        public static uint SubWord(uint word)
        {
            byte[] bytes = BitConverter.GetBytes(word);
            SBox   sBox  = SBox.GetInstance();

            for (int i = 0; i < sizeof(int); i++)
            {
                bytes[i] = sBox.Substitute(bytes[i]);
            }
            return(BitConverter.ToUInt32(bytes));
        }
Beispiel #3
0
 public static SBox GetInstance()
 {
     if (instance == null)
     {
         lock (syncRoot)
         {
             if (instance == null)
             {
                 instance = new SBox();
             }
         }
     }
     return(instance);
 }