CryptoSys PKI Pro Manual

Prf.Bytes Method

Generate output bytes using a pseudorandom function (PRF).

Syntax

[C#]
public static byte[] Bytes(
   int numBytes,
   byte[] message,
   byte[] key,
   Prf.Alg prfAlg,
   string customStr = "" 
)
[VB]
Public Shared Function Bytes (
   numBytes As Integer,
   message As Byte(),
   key As Byte(),
   prfAlg As Prf.Alg,
   Optional customStr As String = "" 
) As Byte()

Parameters

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

Return Value

Byte
Output data in byte array.

Example

// 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

VB6/C equivalent: PRF_Bytes

[Contents] [Index]

[PREV: Pfx.SignatureIsValid Method...]   [Contents]   [Index]   
   [NEXT: Pwd.Prompt Method...]

Copyright © 2004-26 D.I. Management Services Pty Ltd t/a CryptoSys. All rights reserved. Generated 2026-09-21T05:59:39Z.