public byte[] CalculateHash(byte[] value) { var digest = new KeccakDigest(256); var output = new byte[digest.GetDigestSize()]; digest.BlockUpdate(value, 0, value.Length); digest.DoFinal(output, 0); return output; }
private void CopyIn(KeccakDigest source) { Array.Copy(source.state, 0, this.state, 0, source.state.Length); Array.Copy(source.dataQueue, 0, this.dataQueue, 0, source.dataQueue.Length); this.rate = source.rate; this.bitsInQueue = source.bitsInQueue; this.fixedOutputLength = source.fixedOutputLength; this.squeezing = source.squeezing; }
public KeccakDigest(KeccakDigest source) { this.state = new byte[200]; this.dataQueue = new byte[0xc0]; this.C = new ulong[5]; this.tempA = new ulong[0x19]; this.chiC = new ulong[5]; this.CopyIn(source); }
public string CalculateHash(string value) { var digest = new KeccakDigest(256); var output = new byte[digest.GetDigestSize()]; var input = Encoding.UTF8.GetBytes(value); digest.BlockUpdate(input, 0, input.Length); digest.DoFinal(output, 0); return output.ToHex(); }
public static byte[] Keccak(byte[] data) { var digest = new Org.BouncyCastle.Crypto.Digests.KeccakDigest(256); digest.BlockUpdate(data, 0, data.Length); byte[] hash = new byte[32]; digest.DoFinal(hash, 0); return(hash); }
private void CopyIn(KeccakDigest source) { Array.Copy(source.state, 0, this.state, 0, source.state.Length); Array.Copy(source.dataQueue, 0, this.dataQueue, 0, source.dataQueue.Length); this.rate = source.rate; this.bitsInQueue = source.bitsInQueue; this.fixedOutputLength = source.fixedOutputLength; this.squeezing = source.squeezing; this.bitsAvailableForSqueezing = source.bitsAvailableForSqueezing; this.chunk = Arrays.Clone(source.chunk); this.oneByte = Arrays.Clone(source.oneByte); }
private void CopyIn(KeccakDigest source) { global::System.Array.Copy((global::System.Array)source.state, 0, (global::System.Array)state, 0, source.state.Length); global::System.Array.Copy((global::System.Array)source.dataQueue, 0, (global::System.Array)dataQueue, 0, source.dataQueue.Length); rate = source.rate; bitsInQueue = source.bitsInQueue; fixedOutputLength = source.fixedOutputLength; squeezing = source.squeezing; bitsAvailableForSqueezing = source.bitsAvailableForSqueezing; chunk = Arrays.Clone(source.chunk); oneByte = Arrays.Clone(source.oneByte); }
public virtual void Reset(IMemoable other) { KeccakDigest d = (KeccakDigest)other; CopyIn(d); }
public KeccakDigest(KeccakDigest source) { CopyIn(source); }
public virtual void Reset(IMemoable other) { KeccakDigest source = (KeccakDigest)other; CopyIn(source); }