Exemple #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]);
            }
        }
Exemple #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));
        }
Exemple #3
0
 public static SBox GetInstance()
 {
     if (instance == null)
     {
         lock (syncRoot)
         {
             if (instance == null)
             {
                 instance = new SBox();
             }
         }
     }
     return(instance);
 }