Org.BouncyCastle.Crypto.Engines.SkipjackEngine.Init C# (CSharp) Method

Init() public method

public Init ( bool forEncryption, ICipherParameters parameters ) : void
forEncryption bool
parameters ICipherParameters
return void
        public void Init(
            bool				forEncryption,
            ICipherParameters	parameters)
        {
            if (!(parameters is KeyParameter))
	            throw new ArgumentException("invalid parameter passed to SKIPJACK init - " + parameters.GetType().ToString());

			byte[] keyBytes = ((KeyParameter)parameters).GetKey();

            this.encrypting = forEncryption;
            this.key0 = new int[32];
            this.key1 = new int[32];
            this.key2 = new int[32];
            this.key3 = new int[32];

            //
            // expand the key to 128 bytes in 4 parts (saving us a modulo, multiply
            // and an addition).
            //
            for (int i = 0; i < 32; i ++)
            {
                key0[i] = keyBytes[(i * 4) % 10] & 0xff;
                key1[i] = keyBytes[(i * 4 + 1) % 10] & 0xff;
                key2[i] = keyBytes[(i * 4 + 2) % 10] & 0xff;
                key3[i] = keyBytes[(i * 4 + 3) % 10] & 0xff;
            }
        }