BitCoinClient.Worker.SHATransform C# (CSharp) Method

SHATransform() public method

public SHATransform ( uint output, uint init, uint data ) : void
output uint
init uint
data uint
return void
        void SHATransform(uint[] output, uint[] init, uint[] data)
        {
            OpenSSL.Core.SHA256 sha = new OpenSSL.Core.SHA256();

            byte[] swapped = new byte[data.Length * 4];
            for (int i = 0; i < data.Length; i++)
            {
                int byidx = i * 4;
                swapped[byidx + 0] = (byte)((data[i] & 0xFF000000) >> 24);
                swapped[byidx + 1] = (byte)((data[i] & 0x00FF0000) >> 16);
                swapped[byidx + 2] = (byte)((data[i] & 0x0000FF00) >> 8);
                swapped[byidx + 3] = (byte)((data[i] & 0x000000FF) );
            }

            Array.Copy(init, sha.ctx.h, 8);
            sha.Update(swapped);
            Buffer.BlockCopy(sha.ctx.h, 0, output, 0, 32);
        }