public override byte[] GetBytes(int byteCount) { var result = new byte[byteCount]; _xof.XofSizeInBits = (ulong)byteCount * 8; _xof.Initialize(); _xof.TransformBytes(_srcKey); // derive the SubKey _xof.DoOutput(result, 0, (ulong)result.Length); _xof.Initialize(); return(result); }
} // end function Clone public override byte[] GetBytes(Int32 byteCount) { var result = new byte[byteCount]; Xof.XOFSizeInBits = (UInt64)byteCount * 8; Xof.Initialize(); Xof.TransformBytes(SrcKey); // derive the SubKey Xof.DoOutput(ref result, 0, (UInt64)result.Length); Xof.Initialize(); return(result); }
protected void DoComputeKMACXOF(IXOF xofInstance, byte[] data) { var result = new byte[xofInstance.XofSizeInBits >> 3]; xofInstance.Initialize(); xofInstance.TransformBytes(data); xofInstance.DoOutput(result, 0, (ulong)result.Length); ActualString = Converters.ConvertBytesToHexString(result); AssertAreEqual(ExpectedString, ActualString); }
protected static unsafe void CallShouldRaiseException(IXOF XofInstance) { byte[] Output = new byte[XofInstance.XOFSizeInBits >> 3]; fixed(byte *bPtr = TestConstants.Bytesabcde) { IntPtr abcdePtr = (IntPtr)bPtr; XofInstance.Initialize(); XofInstance.TransformUntyped(abcdePtr, TestConstants.Bytesabcde.Length); XofInstance.DoOutput(ref Output, 0, (UInt64)Output.Length); // this call below should raise exception since we have already read from the Xof XofInstance.TransformUntyped(abcdePtr, TestConstants.Bytesabcde.Length); } // } //