Beispiel #1
0
        public override void SetParameter(Octets param)
        {
            Octets k_ipad = new Octets(64);
            int keylen = param.size();

            if (keylen > 64)
            {
                Octets key = MD5Hash.Digest(param);
                k_ipad.replace(key);
                k_opad.replace(key);
                keylen = key.size();
            }
            else
            {
                k_ipad.replace(param);
                k_opad.replace(param);
            }

            int i = 0;
            for (; i < keylen; i++)
            {
                k_ipad.setByte(i, (byte)(k_ipad.getByte(i) ^ 0x36));
                k_opad.setByte(i, (byte)(k_opad.getByte(i) ^ 0x5c));
            }
            for (; i < 64; i++)
            {
                k_ipad.setByte(i, (byte)0x36);
                k_opad.setByte(i, (byte)0x5c);
            }
            k_ipad.resize(64);
            k_opad.resize(64);            
            md5hash.Update(k_ipad);
        }
Beispiel #2
0
 public OctetsStream unmarshal(Octets os, int size)
 {
     if (pos + size > this.size()) throw new MarshalException();
     os.replace(this, pos, size);
     pos += size;
     return this;
 }
Beispiel #3
0
 public override Octets Final(Octets digest)
 {
     digest.replace(md5.ComputeHash(context.getBytes()));
     context.clear();
     return digest;
 }
Beispiel #4
0
 public OctetsStream unmarshal(Octets os)
 {
     int size = (int)uncompact_uint32();
     if (pos + size > this.size()) throw new MarshalException();
     os.replace(this, pos, size);
     pos += size;
     return this;
 }