示例#1
0
 private Sha2HashAlgorithm(int bitLen)
 {
     this._bitLen    = bitLen;
     this._sha2      = Sha2.Create(bitLen);
     this._finalHash = null;
     this._stream    = new MemoryStream();
 }
示例#2
0
        public static ICryptoHash Create(CryptoHashName hash)
        {
            switch (hash)
            {
            case CryptoHashName.Sha256:
                return(Sha2.Create(256));

            case CryptoHashName.Sha224:
                return(Sha2.Create(224));

            case CryptoHashName.Sha512:
                return(Sha2.Create(512));

            case CryptoHashName.Sha384:
                return(Sha2.Create(384));

            case CryptoHashName.Blake256:
                return(Blake.Create(256));

            case CryptoHashName.Blake224:
                return(Blake.Create(224));

            case CryptoHashName.Blake512:
                return(Blake.Create(512));

            case CryptoHashName.Blake384:
                return(Blake.Create(384));

            case CryptoHashName.Groestl256:
                return(Groestl.Create(256));

            case CryptoHashName.Groestl224:
                return(Groestl.Create(224));

            case CryptoHashName.Groestl512:
                return(Groestl.Create(512));

            case CryptoHashName.Groestl384:
                return(Groestl.Create(384));

            case CryptoHashName.JH256:
                return(JH.Create(256));

            case CryptoHashName.JH224:
                return(JH.Create(224));

            case CryptoHashName.JH512:
                return(JH.Create(512));

            case CryptoHashName.JH384:
                return(JH.Create(384));

            case CryptoHashName.Skein256:
                return(Skein.Create(256));

            case CryptoHashName.Skein224:
                return(Skein.Create(224));

            case CryptoHashName.Skein512:
                return(Skein.Create(512));

            case CryptoHashName.Skein384:
                return(Skein.Create(384));

            case CryptoHashName.QmhHuk256:
                return(QmhHuk.Create(256));

            case CryptoHashName.QmhHuk224:
                return(QmhHuk.Create(224));

            case CryptoHashName.QmhHuk512:
                return(QmhHuk.Create(512));

            case CryptoHashName.QmhHuk384:
                return(QmhHuk.Create(384));

            default:
                throw new ArgumentException();
            }
        }