Generates a random set of byte data suitable for cryptographic keys.
VB6/VBA
Debug.Print "Testing RNG_KeyBytes ..." Dim abKey() As Byte Dim nRet As Long Dim nKeyBytes As Long Dim i As Integer nKeyBytes = 24 ReDim abKey(nKeyBytes - 1) ' Generate three successive 192-bit random keys with no seeding For i = 1 To 3 nRet = RNG_KeyBytes(abKey(0), nKeyBytes, "", 0) Debug.Print cnvHexStrFromBytes(abKey) Next
Output
Testing RNG_KeyBytes ... 4D0EBF888123A4F66836264B939A4FBBF6B88C5A37A4A77D D28E1ECE35C6A4D9953E5E755C21B6D9EA6CD87E2A9C125D 94E095902E24537014FE6133C2AB23EC5C002F78B24501CB
VB.NET
Console.WriteLine("Testing RNG_KeyBytes ...") Dim abKey() As Byte ''Dim nRet As Integer Dim nKeyBytes As Integer Dim i As Integer nKeyBytes = 24 ''ReDim abKey(nKeyBytes - 1) ' Generate three successive 192-bit random keys with no seeding For i = 1 To 3 abKey = Rng.KeyBytes(nKeyBytes, "") Console.WriteLine(Cnv.ToHex(abKey)) Next
[Contents]