/**
		 * Construct a Pkcs 12 Parameters generator.
		 *
		 * @param digest the digest to be used as the source of derived keys.
		 * @exception ArgumentException if an unknown digest is passed in.
		 */
		public Pkcs12ParametersGenerator(
			IDigest digest)
		{
			this.digest = digest;

			u = digest.GetDigestSize();
			v = digest.GetByteLength();
		}
Exemplo n.º 2
0
		public HMac(IDigest digest)
		{
			this.digest = digest;
			this.digestSize = digest.GetDigestSize();
			this.blockLength = digest.GetByteLength();
			this.inputPad = new byte[blockLength];
			this.outputBuf = new byte[blockLength + digestSize];
		}
Exemplo n.º 3
0
        /**
         * Construct a Pkcs 12 Parameters generator.
         *
         * @param digest the digest to be used as the source of derived keys.
         * @exception ArgumentException if an unknown digest is passed in.
         */
        public Pkcs12ParametersGenerator(
            IDigest digest)
        {
            this.digest = digest;

            u = digest.GetDigestSize();
            v = digest.GetByteLength();
        }
Exemplo n.º 4
0
 public HMac(IDigest digest)
 {
     this.digest      = digest;
     this.digestSize  = digest.GetDigestSize();
     this.blockLength = digest.GetByteLength();
     this.inputPad    = new byte[blockLength];
     this.outputBuf   = new byte[blockLength + digestSize];
 }
Exemplo n.º 5
0
        public static byte[] ComputeHash(this IDigest digest, byte[] data)
        {
            digest.Reset();
            digest.BlockUpdate(data, 0, data.Length);
            var hash = new byte[digest.GetByteLength()];

            digest.DoFinal(hash, 0);
            return(hash);
        }
Exemplo n.º 6
0
        public HMac(
            IDigest digest)
        {
            this.digest = digest;
            digestSize  = digest.GetDigestSize();

            blockLength = digest.GetByteLength();

            inputPad  = new byte[blockLength];
            outputPad = new byte[blockLength];
        }
Exemplo n.º 7
0
        public HMac(
            IDigest digest)
        {
            this.digest = digest;
            digestSize = digest.GetDigestSize();

            blockLength = digest.GetByteLength();

            inputPad = new byte[blockLength];
            outputPad = new byte[blockLength];
        }
        public override byte[] ComputeHash(Stream inputStream)
        {
            if (inputStream == null)
            {
                throw new ArgumentNullException("inputStream");
            }

            _hashAlgorithm.Reset();
            byte[] block = new byte[_hashAlgorithm.GetByteLength()];
            int    count;

            while ((count = inputStream.Read(block, 0, block.Length)) > 0)
            {
                _hashAlgorithm.BlockUpdate(block, 0, count);
            }
            return(Hash());
        }
 public int GetByteLength()
 {
     return(baseDigest.GetByteLength());
 }
Exemplo n.º 10
0
 public virtual int GetByteLength()
 {
     return(System.Math.Max(mMd5.GetByteLength(), mSha1.GetByteLength()));
 }
 public int GetByteLength()
 {
     return(System.Math.Max(md5.GetByteLength(), sha1.GetByteLength()));
 }
Exemplo n.º 12
0
 public virtual int GetByteLength()
 {
     return(mBaseDigest.GetByteLength());
 }