Esempio n. 1
0
        public void Reset(IMemoable other)
        {
            SkeinDigest d = (SkeinDigest)other;

            engine.Reset(d.engine);
        }
Esempio n. 2
0
 public SkeinDigest(SkeinDigest digest)
 {
     this.engine = new SkeinEngine(digest.engine);
 }
Esempio n. 3
0
		public SkeinDigest(SkeinDigest digest)
		{
			this.engine = new SkeinEngine(digest.engine);
		}
Esempio n. 4
0
		private void runTest(Case dc)
		{
			SkeinDigest digest = new SkeinDigest(dc.getBlockSize(), dc.getOutputSize());

			byte[] message = dc.getMessage();
			digest.BlockUpdate(message, 0, message.Length);

			byte[] output = new byte[digest.GetDigestSize()];
			digest.DoFinal(output, 0);

			if (!AreEqual(output, dc.getDigest()))
			{
				Fail(digest.AlgorithmName + " message mismatch.\n Message " + Hex.ToHexString(dc.getMessage()),
				     Hex.ToHexString(dc.getDigest()), Hex.ToHexString(output));
			}

			// Clone test
			digest.BlockUpdate(message, 0, message.Length / 2);

			// clone the Digest
			IDigest d = new SkeinDigest(digest);

			digest.BlockUpdate(message, message.Length / 2, message.Length - message.Length / 2);
			digest.DoFinal(output, 0);

			if (!AreEqual(dc.getDigest(), output))
			{
				Fail("failing clone vector test", Hex.ToHexString(dc.getDigest()), Hex.ToHexString(output));
			}

			d.BlockUpdate(message, message.Length / 2, message.Length - message.Length / 2);
			d.DoFinal(output, 0);

			if (!AreEqual(dc.getDigest(), output))
			{
				Fail("failing second clone vector test", Hex.ToHexString(dc.getDigest()), Hex.ToHexString(output));
			}

			//	        //
			//	        // memo test
			//	        //
			//	        Memoable m = (Memoable)digest;
			//
			//	        digest.Update(message, 0, message.Length / 2);
			//
			//	        // copy the Digest
			//	        Memoable copy1 = m.copy();
			//	        Memoable copy2 = copy1.copy();
			//
			//	        digest.Update(message, message.Length / 2, message.Length - message.Length / 2);
			//	        digest.DoFinal(output, 0);
			//
			//	        if (!AreEqual(dc.getDigest(), output))
			//	        {
			//				Fail("failing memo vector test", Hex.ToHexString(dc.getDigest()), Hex.ToHexString(output));
			//	        }
			//
			//	        m.reset(copy1);
			//
			//	        digest.Update(message, message.Length / 2, message.Length - message.Length / 2);
			//	        digest.DoFinal(output, 0);
			//
			//	        if (!AreEqual(dc.getDigest(), output))
			//	        {
			//				fail("failing memo reset vector test", Hex.ToHexString(dc.getDigest()), Hex.ToHexString(output));
			//	        }
			//
			//	        IDigest md = (IDigest)copy2;
			//
			//	        md.Update(message, message.Length / 2, message.Length - message.Length / 2);
			//	        md.DoFinal(output, 0);
			//
			//	        if (!AreEqual(dc.getDigest(), output))
			//	        {
			//				Fail("failing memo copy vector test", Hex.ToHexString(dc.getDigest()), Hex.ToHexString(output));
			//	        }
		}
        private static byte[] GetHash(string filePath)
        {
            var data = File.ReadAllBytes(filePath);

            var digest = new SkeinDigest(512, 512);
            digest.BlockUpdate(data, 0, data.Length);

            var hash = new byte[digest.GetDigestSize()];
            digest.DoFinal(hash, 0);
            return hash;
        }
Esempio n. 6
0
        public void Reset(IMemoable other)
        {
            SkeinDigest skeinDigest = (SkeinDigest)other;

            this.engine.Reset(skeinDigest.engine);
        }