leftRotate() private static method

private static leftRotate ( uint x, int s ) : uint
x uint
s int
return uint
示例#1
0
 private void camelliaFLs(uint[] s, uint[] fkey, int keyoff)
 {
     s[1] ^= CamelliaLightEngine.leftRotate(s[0] & fkey[keyoff], 1);
     s[0] ^= (fkey[1 + keyoff] | s[1]);
     s[2] ^= (fkey[3 + keyoff] | s[3]);
     s[3] ^= CamelliaLightEngine.leftRotate(fkey[2 + keyoff] & s[2], 1);
 }
示例#2
0
        private void camelliaF2(uint[] s, uint[] skey, int keyoff)
        {
            uint num  = s[0] ^ skey[keyoff];
            uint num2 = this.sbox4((int)((byte)num));

            num2 |= this.sbox3((int)((byte)(num >> 8))) << 8;
            num2 |= this.sbox2((int)((byte)(num >> 16))) << 16;
            num2 |= (uint)((uint)CamelliaLightEngine.SBOX1[(int)((byte)(num >> 24))] << 24);
            uint num3 = s[1] ^ skey[1 + keyoff];
            uint num4 = (uint)CamelliaLightEngine.SBOX1[(int)((byte)num3)];

            num4 |= this.sbox4((int)((byte)(num3 >> 8))) << 8;
            num4 |= this.sbox3((int)((byte)(num3 >> 16))) << 16;
            num4 |= this.sbox2((int)((byte)(num3 >> 24))) << 24;
            num4  = CamelliaLightEngine.leftRotate(num4, 8);
            num2 ^= num4;
            num4  = (CamelliaLightEngine.leftRotate(num4, 8) ^ num2);
            num2  = (CamelliaLightEngine.rightRotate(num2, 8) ^ num4);
            s[2] ^= (CamelliaLightEngine.leftRotate(num4, 16) ^ num2);
            s[3] ^= CamelliaLightEngine.leftRotate(num2, 8);
            num   = (s[2] ^ skey[2 + keyoff]);
            num2  = this.sbox4((int)((byte)num));
            num2 |= this.sbox3((int)((byte)(num >> 8))) << 8;
            num2 |= this.sbox2((int)((byte)(num >> 16))) << 16;
            num2 |= (uint)((uint)CamelliaLightEngine.SBOX1[(int)((byte)(num >> 24))] << 24);
            num3  = (s[3] ^ skey[3 + keyoff]);
            num4  = (uint)CamelliaLightEngine.SBOX1[(int)((byte)num3)];
            num4 |= this.sbox4((int)((byte)(num3 >> 8))) << 8;
            num4 |= this.sbox3((int)((byte)(num3 >> 16))) << 16;
            num4 |= this.sbox2((int)((byte)(num3 >> 24))) << 24;
            num4  = CamelliaLightEngine.leftRotate(num4, 8);
            num2 ^= num4;
            num4  = (CamelliaLightEngine.leftRotate(num4, 8) ^ num2);
            num2  = (CamelliaLightEngine.rightRotate(num2, 8) ^ num4);
            s[0] ^= (CamelliaLightEngine.leftRotate(num4, 16) ^ num2);
            s[1] ^= CamelliaLightEngine.leftRotate(num2, 8);
        }