Esempio n. 1
0
        private void setHash(int hashFlag)
        {
            switch ((hashFlag & 0xff))
            {
                case 1:
                    this.hash = new HMACGenerator();
                    this.hash.setHashLen(20);
                    Debug.WriteLine("MODE: Hash HMAC Len 0x14");
                    return;

                case 2:
                    this.hash = new CMACGenerator();
                    this.hash.setHashLen(0x10);
                    Debug.WriteLine("MODE: Hash CMAC Len 0x10");
                    return;

                case 4:
                    this.hash = new HMACGenerator();
                    this.hash.setHashLen(0x10);
                    Debug.WriteLine("MODE: Hash HMAC Len 0x10");
                    return;
            }
            throw new Exception("Hash mode is not valid: Undefined hash algorithm");
        }