Beispiel #1
0
 public static byte[] RadioGatun32(byte[] bytes)
 {
     if (!RadioGatun32Hashers.TryPop(out var hasher))
     {
         hasher = new RadioGatun32Digest();
     }
     try {
         var result = new byte[hasher.GetDigestSize()];
         hasher.BlockUpdate(bytes, 0, bytes.Length);
         hasher.DoFinal(result, 0);
         hasher.Reset();
         return(result);
     } finally {
         RadioGatun32Hashers.Push(hasher);
     }
 }
        public void Reset(IMemoable other)
        {
            RadioGatun32Digest originalDigest = (RadioGatun32Digest)other;

            Array.Copy(originalDigest._mMill, 0, _mMill, 0, _mMill.Length);
            Array.Copy(originalDigest._buffer, 0, _buffer, 0, _buffer.Length);

            int outerSourceArrayLength = originalDigest._mBelt.Length;

            _mBelt = new uint[outerSourceArrayLength][];

            for (var idx = 0; idx < outerSourceArrayLength; idx++)
            {
                uint[] innerSourceArray       = originalDigest._mBelt[idx];
                int    innerSourceArrayLength = innerSourceArray.Length;
                _mBelt[idx] = new uint[innerSourceArrayLength];
                Array.Copy(innerSourceArray, _mBelt[idx], innerSourceArrayLength);
            }

            _bufferPos      = originalDigest._bufferPos;
            _processedBytes = originalDigest._processedBytes;
        }
 /**
  * Copy constructor.  This will copy the state of the provided
  * message digest.
  */
 public RadioGatun32Digest(RadioGatun32Digest t)
 {
     Reset(t);
 }