Inheritance: GeneralDigest
示例#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;
        }
示例#2
0
文件: Hashes.cs 项目: crowar/NBitcoin
		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
		}
示例#3
0
文件: Hashes.cs 项目: crowar/NBitcoin
		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
		}
示例#4
0
        /**
        * Copy constructor.  This will copy the state of the provided
        * message digest.
        */
        public Sha256Digest(Sha256Digest t) : base(t)
        {
			CopyIn(t);
		}
示例#5
0
 /**
  * Copy constructor.  This will copy the state of the provided
  * message digest.
  */
 public Sha256Digest(Sha256Digest t) : base(t)
 {
     CopyIn(t);
 }
示例#6
0
        public override void Reset(IMemoable other)
        {
            Sha256Digest d = (Sha256Digest)other;

            CopyIn(d);
        }