CryptoSys API Library Manual

Example: Blowfish.Dispose  Blowfish.InitEncrypt  Blowfish.Instance  Blowfish.Update 

[VB6 equivalent: BLF_UpdateHex]

Dim nRet As Integer
Dim strKey As String
Dim strHexString As String
Dim oBlowfish As Blowfish = Blowfish.Instance()

strKey = "0123456789abcdef"
Console.WriteLine("KY=" & " " & strKey)

' Initialise the context
nRet = oBlowfish.InitEncrypt(strKey, Mode.ECB, Nothing)
If nRet <> 0 Then
    ' Always check for error
    Console.WriteLine("ERROR: Unable to initialise BLF context")
    Exit Sub
End If

'              "Now is t"
strHexString = "4e6f772069732074"
Console.WriteLine("PT=" & " " & strHexString)
strHexString = oBlowfish.Update(strHexString)
Console.WriteLine("CT=" & " " & strHexString)
Console.WriteLine("OK=" & " " & "cb08e682c67e32e2")

'              "he time for all"
strHexString = "68652074696d6520666f7220616c6c20"
Console.WriteLine("PT=" & " " & strHexString)
strHexString = oBlowfish.Update(strHexString)
Console.WriteLine("CT=" & " " & strHexString)
Console.WriteLine("OK=" & " " & "8fcb010ac2ce9b1d9c4538762e33b52f")

oBlowfish.Dispose()

See Also:
Blowfish.Update Method (String)

[Contents] [Index]

[PREV: Example: Blowfish.Dispose ...]   [Contents]   [Index]   
   [NEXT: Example: Cipher.KeyUnwrap ...]

Copyright © 2001-23 D.I. Management Services Pty Ltd. All rights reserved. Generated 2023-05-20T13:01:10Z.