CloneHash() public static method

public static CloneHash ( byte hashAlgorithm, IDigest hash ) : IDigest
hashAlgorithm byte
hash IDigest
return IDigest
コード例 #1
0
        public virtual IDigest ForkPrfHash()
        {
            CheckStopBuffering();
            byte b = (byte)mPrfHashAlgorithm;

            if (mBuf != null)
            {
                IDigest digest = TlsUtilities.CreateHash(b);
                mBuf.UpdateDigest(digest);
                return(digest);
            }
            return(TlsUtilities.CloneHash(b, (IDigest)mHashes.get_Item((object)b)));
        }
コード例 #2
0
        public virtual IDigest ForkPrfHash()
        {
            this.CheckStopBuffering();
            byte b = (byte)this.mPrfHashAlgorithm;

            if (this.mBuf != null)
            {
                IDigest digest = TlsUtilities.CreateHash(b);
                this.mBuf.UpdateDigest(digest);
                return(digest);
            }
            return(TlsUtilities.CloneHash(b, (IDigest)this.mHashes[b]));
        }
コード例 #3
0
        public virtual TlsHandshakeHash StopTracking()
        {
            byte    prfHashAlgorithm = (byte)mPrfHashAlgorithm;
            IDigest prfHash          = TlsUtilities.CloneHash(prfHashAlgorithm, (IDigest)mHashes[prfHashAlgorithm]);

            if (mBuf != null)
            {
                mBuf.UpdateDigest(prfHash);
            }
            DeferredHash result = new DeferredHash(prfHashAlgorithm, prfHash);

            result.Init(mContext);
            return(result);
        }
コード例 #4
0
        public virtual TlsHandshakeHash StopTracking()
        {
            byte    b      = (byte)mPrfHashAlgorithm;
            IDigest digest = TlsUtilities.CloneHash(b, (IDigest)mHashes.get_Item((object)b));

            if (mBuf != null)
            {
                mBuf.UpdateDigest(digest);
            }
            DeferredHash deferredHash = new DeferredHash(b, digest);

            deferredHash.Init(mContext);
            return(deferredHash);
        }
コード例 #5
0
        public virtual TlsHandshakeHash StopTracking()
        {
            byte    b      = (byte)this.mPrfHashAlgorithm;
            IDigest digest = TlsUtilities.CloneHash(b, (IDigest)this.mHashes[b]);

            if (this.mBuf != null)
            {
                this.mBuf.UpdateDigest(digest);
            }
            DeferredHash deferredHash = new DeferredHash(b, digest);

            deferredHash.Init(this.mContext);
            return(deferredHash);
        }
コード例 #6
0
        public virtual TlsHandshakeHash StopTracking()
        {
            byte    mPrfHashAlgorithm = (byte)this.mPrfHashAlgorithm;
            IDigest d = TlsUtilities.CloneHash(mPrfHashAlgorithm, (IDigest)this.mHashes[mPrfHashAlgorithm]);

            if (this.mBuf != null)
            {
                this.mBuf.UpdateDigest(d);
            }
            DeferredHash hash = new DeferredHash(mPrfHashAlgorithm, d);

            hash.Init(this.mContext);
            return(hash);
        }
コード例 #7
0
        public virtual IDigest ForkPrfHash()
        {
            CheckStopBuffering();

            byte prfHashAlgorithm = (byte)mPrfHashAlgorithm;

            if (mBuf != null)
            {
                IDigest prfHash = TlsUtilities.CreateHash(prfHashAlgorithm);
                mBuf.UpdateDigest(prfHash);
                return(prfHash);
            }

            return(TlsUtilities.CloneHash(prfHashAlgorithm, (IDigest)mHashes[prfHashAlgorithm]));
        }
コード例 #8
0
        public virtual byte[] GetFinalHash(byte hashAlgorithm)
        {
            IDigest digest = (IDigest)this.mHashes[hashAlgorithm];

            if (digest == null)
            {
                throw new InvalidOperationException("HashAlgorithm " + hashAlgorithm + " is not being tracked");
            }
            digest = TlsUtilities.CloneHash(hashAlgorithm, digest);
            if (this.mBuf != null)
            {
                this.mBuf.UpdateDigest(digest);
            }
            return(DigestUtilities.DoFinal(digest));
        }
コード例 #9
0
        public virtual byte[] GetFinalHash(byte hashAlgorithm)
        {
            IDigest hash = (IDigest)this.mHashes[hashAlgorithm];

            if (hash == null)
            {
                throw new InvalidOperationException("HashAlgorithm." + HashAlgorithm.GetText(hashAlgorithm) + " is not being tracked");
            }
            hash = TlsUtilities.CloneHash(hashAlgorithm, hash);
            if (this.mBuf != null)
            {
                this.mBuf.UpdateDigest(hash);
            }
            return(DigestUtilities.DoFinal(hash));
        }
コード例 #10
0
        public virtual byte[] GetFinalHash(byte hashAlgorithm)
        {
            //IL_002f: Unknown result type (might be due to invalid IL or missing references)
            IDigest digest = (IDigest)mHashes.get_Item((object)hashAlgorithm);

            if (digest == null)
            {
                throw new InvalidOperationException("HashAlgorithm." + HashAlgorithm.GetText(hashAlgorithm) + " is not being tracked");
            }
            digest = TlsUtilities.CloneHash(hashAlgorithm, digest);
            if (mBuf != null)
            {
                mBuf.UpdateDigest(digest);
            }
            return(DigestUtilities.DoFinal(digest));
        }
コード例 #11
0
ファイル: CombinedHash.cs プロジェクト: flobecker/trudi-koala
 internal CombinedHash(CombinedHash t)
 {
     this.mContext = t.mContext;
     this.mMd5     = TlsUtilities.CloneHash(HashAlgorithm.md5, t.mMd5);
     this.mSha1    = TlsUtilities.CloneHash(HashAlgorithm.sha1, t.mSha1);
 }
コード例 #12
0
 internal CombinedHash(CombinedHash t)
 {
     this.mContext = t.mContext;
     this.mMd5     = TlsUtilities.CloneHash(1, t.mMd5);
     this.mSha1    = TlsUtilities.CloneHash(2, t.mSha1);
 }