Inheritance: GeneralDigest
Beispiel #1
0
		private void CopyIn(Sha256Digest t)
		{
			base.CopyIn(t);

            H1 = t.H1;
            H2 = t.H2;
            H3 = t.H3;
            H4 = t.H4;
            H5 = t.H5;
            H6 = t.H6;
            H7 = t.H7;
            H8 = t.H8;

            Array.Copy(t.X, 0, X, 0, t.X.Length);
            xOff = t.xOff;
        }
Beispiel #2
0
		public static uint256 Hash256(byte[] data, int offset, int count)
		{
#if USEBC || WINDOWS_UWP
			Sha256Digest sha256 = new Sha256Digest();
			sha256.BlockUpdate(data, offset, count);
			byte[] rv = new byte[32];
			sha256.DoFinal(rv, 0);
			sha256.BlockUpdate(rv, 0, rv.Length);
			sha256.DoFinal(rv, 0);
			return new uint256(rv);
#else
			using(var sha = new SHA256Managed())
			{
				var h = sha.ComputeHash(data, offset, count);
				return new uint256(sha.ComputeHash(h, 0, h.Length));
			}
#endif
		}
Beispiel #3
0
		public static byte[] SHA256(byte[] data, int offset, int count)
		{
#if USEBC || WINDOWS_UWP
			Sha256Digest sha256 = new Sha256Digest();
			sha256.BlockUpdate(data, offset, count);
			byte[] rv = new byte[32];
			sha256.DoFinal(rv, 0);
			return rv;
#else
			using(var sha = new SHA256Managed())
			{
				return sha.ComputeHash(data, offset, count);
			}
#endif
		}
Beispiel #4
0
        /**
        * Copy constructor.  This will copy the state of the provided
        * message digest.
        */
        public Sha256Digest(Sha256Digest t) : base(t)
        {
			CopyIn(t);
		}
Beispiel #5
0
 /**
  * Copy constructor.  This will copy the state of the provided
  * message digest.
  */
 public Sha256Digest(Sha256Digest t) : base(t)
 {
     CopyIn(t);
 }
Beispiel #6
0
        public override void Reset(IMemoable other)
        {
            Sha256Digest d = (Sha256Digest)other;

            CopyIn(d);
        }