public static void ReadWrite(this BitcoinStream stream, ref uint512 value)
 {
     value = value ?? uint512.Zero;
     _mutableUint512.Value = value;
     stream.ReadWrite(ref _mutableUint512);
     value = _mutableUint512.Value;
 }
Exemple #2
0
        public byte[] ComputeBytes(byte[] input)
        {
            byte[] lHashResult = input;

            uint512 lZero = new uint512();
            uint512 lMask = new uint512(8);
            uint512 lResult;

            lHashResult = _hashers[HashEnum.Blake].ComputeBytes(lHashResult).GetBytes();
            lHashResult = _hashers[HashEnum.Bmw].ComputeBytes(lHashResult).GetBytes();

            lResult = new uint512(lHashResult);

            if ((lResult & lMask) != lZero)
            {
                lHashResult = _hashers[HashEnum.Groestl].ComputeBytes(lHashResult).GetBytes();
            }
            else
            {
                lHashResult = _hashers[HashEnum.skein].ComputeBytes(lHashResult).GetBytes();
            }

            lHashResult = _hashers[HashEnum.Groestl].ComputeBytes(lHashResult).GetBytes();

            lHashResult = _hashers[HashEnum.jh].ComputeBytes(lHashResult).GetBytes();

            lResult = new uint512(lHashResult);

            if ((lResult & lMask) != lZero)
            {
                lHashResult = _hashers[HashEnum.Blake].ComputeBytes(lHashResult).GetBytes();
            }
            else
            {
                lHashResult = _hashers[HashEnum.Bmw].ComputeBytes(lHashResult).GetBytes();
            }

            lHashResult = _hashers[HashEnum.keccak].ComputeBytes(lHashResult).GetBytes();
            lHashResult = _hashers[HashEnum.skein].ComputeBytes(lHashResult).GetBytes();

            lResult = new uint512(lHashResult);

            if ((lResult & lMask) != lZero)
            {
                lHashResult = _hashers[HashEnum.keccak].ComputeBytes(lHashResult).GetBytes();
            }
            else
            {
                lHashResult = _hashers[HashEnum.jh].ComputeBytes(lHashResult).GetBytes();
            }

            return(lHashResult.Take(32).ToArray());
        }