CryptoSys API Library Manual

Example: Rng.Initialize  Rng.KeyBytes  Rng.UpdateSeedFile 

[VB6 equivalent: RNG_Initialize]

Dim strSeedFile As String
Dim abData() As Byte
Dim nDataLen As Integer
Dim i As Integer
Dim fIsOK As Boolean

strSeedFile = ".\seed.dat"
' 1. Initialize
fIsOK = Rng.Initialize(strSeedFile)
Console.WriteLine("Rng.Initialize('" & strSeedFile & "') returns " & fIsOK & " (expecting TRUE)")

' 2. Generate some random data
nDataLen = 24
For i = 1 To 3
    abData = Rng.KeyBytes(nDataLen, "")
    Console.WriteLine(Cnv.ToHex(abData))
Next

' 3. Update the seed file
fIsOK = Rng.UpdateSeedFile(strSeedFile)
Console.WriteLine("Rng.UpdateSeedFile('" & strSeedFile & "') returns " & fIsOK & " (expecting TRUE)")

See Also:
Rng.Initialize Method

[Contents] [Index]

[HOME]   [NEXT: Example: Rng.KeyBytes ...]

Copyright © 2001-11 D.I. Management Services Pty Ltd. All rights reserved.