Ejemplo n.º 1
0
		public virtual void Init(ICipherParameters parameters)
		{
			digest.Reset();

			byte[] key = ((KeyParameter)parameters).GetKey();
			int keyLength = key.Length;

			if(keyLength > blockLength)
			{
				digest.BlockUpdate(key, 0, keyLength);
				digest.DoFinal(inputPad, 0);

				keyLength = digestSize;
			}
			else
			{
				Array.Copy(key, 0, inputPad, 0, keyLength);
			}

			Array.Clear(inputPad, keyLength, blockLength - keyLength);
			Array.Copy(inputPad, 0, outputBuf, 0, blockLength);

			XorPad(inputPad, blockLength, IPAD);
			XorPad(outputBuf, blockLength, OPAD);

			if(digest is IMemoable)
			{
				opadState = ((IMemoable)digest).Copy();

				((IDigest)opadState).BlockUpdate(outputBuf, 0, blockLength);
			}

			digest.BlockUpdate(inputPad, 0, inputPad.Length);

			if(digest is IMemoable)
			{
				ipadState = ((IMemoable)digest).Copy();
			}
		}
Ejemplo n.º 2
0
		public void Reset(IMemoable other)
		{
			Gost3411Digest t = (Gost3411Digest)other;

			this.sBox = t.sBox;
			cipher.Init(true, new ParametersWithSBox(null, sBox));

			Reset();

			Array.Copy(t.H, 0, this.H, 0, t.H.Length);
			Array.Copy(t.L, 0, this.L, 0, t.L.Length);
			Array.Copy(t.M, 0, this.M, 0, t.M.Length);
			Array.Copy(t.Sum, 0, this.Sum, 0, t.Sum.Length);
			Array.Copy(t.C[1], 0, this.C[1], 0, t.C[1].Length);
			Array.Copy(t.C[2], 0, this.C[2], 0, t.C[2].Length);
			Array.Copy(t.C[3], 0, this.C[3], 0, t.C[3].Length);
			Array.Copy(t.xBuf, 0, this.xBuf, 0, t.xBuf.Length);

			this.xBufOff = t.xBufOff;
			this.byteCount = t.byteCount;
		}
Ejemplo n.º 3
0
		public override void Reset(IMemoable other)
		{
			SM3Digest d = (SM3Digest)other;

			base.CopyIn(d);
			CopyIn(d);
		}
Ejemplo n.º 4
0
		public void Reset(IMemoable other)
		{
			MD2Digest d = (MD2Digest)other;

			CopyIn(d);
		}
		public void Reset(IMemoable other)
		{
			WhirlpoolDigest originalDigest = (WhirlpoolDigest)other;

			Array.Copy(originalDigest._rc, 0, _rc, 0, _rc.Length);

			Array.Copy(originalDigest._buffer, 0, _buffer, 0, _buffer.Length);

			this._bufferPos = originalDigest._bufferPos;
			Array.Copy(originalDigest._bitCount, 0, _bitCount, 0, _bitCount.Length);

			// -- internal hash state --
			Array.Copy(originalDigest._hash, 0, _hash, 0, _hash.Length);
			Array.Copy(originalDigest._K, 0, _K, 0, _K.Length);
			Array.Copy(originalDigest._L, 0, _L, 0, _L.Length);
			Array.Copy(originalDigest._block, 0, _block, 0, _block.Length);
			Array.Copy(originalDigest._state, 0, _state, 0, _state.Length);
		}
Ejemplo n.º 6
0
        public virtual void Reset(IMemoable other)
        {
            KeccakDigest d = (KeccakDigest)other;

            CopyIn(d);
        }
Ejemplo n.º 7
0
        public void Reset(IMemoable other)
        {
            MD2Digest d = (MD2Digest)other;

            CopyIn(d);
        }
Ejemplo n.º 8
0
 public void Reset(IMemoable other)
 {
     digest.Reset(other);
 }
        public override void Reset(IMemoable other)
        {
            var d = (Sha256Digest)other;

            CopyIn(d);
        }
Ejemplo n.º 10
0
        public virtual void Reset(IMemoable other)
        {
            Dstu7564Digest d = (Dstu7564Digest)other;

            CopyIn(d);
        }
Ejemplo n.º 11
0
        public override void Reset(IMemoable other)
        {
            Sha1Digest t = (Sha1Digest)other;

            CopyIn(t);
        }
Ejemplo n.º 12
0
        public void Reset(IMemoable other)
        {
            Sha3Digest d = (Sha3Digest)other;

            CopyIn(d);
        }
Ejemplo n.º 13
0
        public override void Reset(IMemoable other)
        {
            var d = (RipeMD160Digest)other;

            CopyIn(d);
        }
Ejemplo n.º 14
0
        public void Reset(IMemoable other)
        {
            MD2Digest t = (MD2Digest)other;

            this.CopyIn(t);
        }
Ejemplo n.º 15
0
		public abstract void Reset(IMemoable t);
Ejemplo n.º 16
0
		public override void Reset(IMemoable other)
		{
			Sha512tDigest t = (Sha512tDigest)other;

			if (this.digestLength != t.digestLength)
			{
				throw new MemoableResetException("digestLength inappropriate in other");
			}

			base.CopyIn(t);

			this.H1t = t.H1t;
			this.H2t = t.H2t;
			this.H3t = t.H3t;
			this.H4t = t.H4t;
			this.H5t = t.H5t;
			this.H6t = t.H6t;
			this.H7t = t.H7t;
			this.H8t = t.H8t;
		}
Ejemplo n.º 17
0
        public override void Reset(IMemoable other)
        {
            Sha512Digest t = (Sha512Digest)other;

            base.CopyIn(t);
        }
Ejemplo n.º 18
0
 public abstract void Reset(IMemoable t);
Ejemplo n.º 19
0
        public void Reset(IMemoable other)
        {
            Sha3Digest source = (Sha3Digest)other;

            this.CopyIn(source);
        }
Ejemplo n.º 20
0
        public virtual void Reset(IMemoable other)
        {
            KeccakDigest d = (KeccakDigest)other;

            CopyIn(d);
        }
Ejemplo n.º 21
0
        public override void Reset(IMemoable other)
        {
            MD5Digest t = (MD5Digest)other;

            this.CopyIn(t);
        }
Ejemplo n.º 22
0
        public override void Reset(IMemoable other)
        {
            RipeMD128Digest t = (RipeMD128Digest)other;

            this.CopyIn(t);
        }
Ejemplo n.º 23
0
 public virtual void Reset(IMemoable other)
 {
     CopyIn((KeccakDigest)other);
 }
Ejemplo n.º 24
0
		public void Reset(IMemoable other)
		{
			Sha3Digest d = (Sha3Digest)other;

			CopyIn(d);
		}
Ejemplo n.º 25
0
    public void Reset(IMemoable other)
    {
        SkeinDigest skeinDigest = (SkeinDigest)other;

        engine.Reset(skeinDigest.engine);
    }
		public void Reset(IMemoable other)
		{
			TigerDigest t = (TigerDigest)other;

			a = t.a;
			b = t.b;
			c = t.c;

			Array.Copy(t.x, 0, x, 0, t.x.Length);
			xOff = t.xOff;

			Array.Copy(t.Buffer, 0, Buffer, 0, t.Buffer.Length);
			bOff = t.bOff;

			byteCount = t.byteCount;
		}    
Ejemplo n.º 27
0
        public override void Reset(IMemoable other)
        {
            MD5Digest d = (MD5Digest)other;

            CopyIn(d);
        }
Ejemplo n.º 28
0
		public void Reset(IMemoable other)
		{
			SkeinDigest d = (SkeinDigest)other;
			engine.Reset(d.engine);
		}
Ejemplo n.º 29
0
        public override void Reset(IMemoable other)
        {
            RipeMD160Digest t = (RipeMD160Digest)other;

            CopyIn(t);
        }
Ejemplo n.º 30
0
 public void Reset(IMemoable other)
 {
     SkeinEngine s = (SkeinEngine)other;
     if ((BlockSize != s.BlockSize) || (outputSizeBytes != s.outputSizeBytes))
     {
         throw new MemoableResetException("Incompatible parameters in provided SkeinEngine.");
     }
     CopyIn(s);
 }
Ejemplo n.º 31
0
        public override void Reset(IMemoable other)
        {
            RipeMD320Digest d = (RipeMD320Digest)other;

            CopyIn(d);
        }
Ejemplo n.º 32
0
		public override void Reset(IMemoable other)
		{
			Sha1Digest d = (Sha1Digest)other;

			CopyIn(d);
		}
Ejemplo n.º 33
0
        public override void Reset(IMemoable other)
        {
            Sha224Digest d = (Sha224Digest)other;

            CopyIn(d);
        }
Ejemplo n.º 34
0
		public override void Reset(IMemoable other)
		{
			RipeMD320Digest d = (RipeMD320Digest)other;

			CopyIn(d);
		}
Ejemplo n.º 35
0
        public override void Reset(IMemoable other)
        {
            Sha256Digest t = (Sha256Digest)other;

            this.CopyIn(t);
        }