Click or drag to resize

PrfBytes Method

Generate output bytes using a pseudorandom function (PRF).

Namespace: CryptoSysPKI
Assembly: diCrSysPKINet (in diCrSysPKINet.dll) Version: 23.0.0.25611 (23.0.0.0)
Syntax
public static byte[] Bytes(
	int numBytes,
	byte[] message,
	byte[] key,
	PrfAlg prfAlg,
	string customStr = ""
)

Parameters

numBytes  Int32
Required number of output bytes.
message  Byte
Input message data.
key  Byte
Key.
prfAlg  PrfAlg
PRF algorithm.
customStr  String  (Optional)
Customization string (optional).

Return Value

Byte
Output data in byte array.
Example
C#
// Sample #1: "standard" KMAC output length KMAC128 => 256 bits, no custom string
int nbytes = 256 / 8;
byte[] msg = "00010203".FromHex();
byte[] key = "404142434445464748494A4B4C4D4E4F505152535455565758595A5B5C5D5E5F".FromHex();
byte[] b = Prf.Bytes(nbytes, msg, key, Prf.Alg.Kmac128);
Console.WriteLine("OUT={0}", b.ToHex());
// E5780B0D3EA6F7D3A429C5706AA43A00FADBD7D49628839E3187243F456EE14E
See Also