Chilkat HOME ASP Visual Basic VB.NET C# Visual C++ C MFC Delphi FoxPro Java Perl PHP Python Ruby SQL Server VBScript
|
Haval Hash Algorithm
VB6 source code example showing how to create a hash of a file using the Haval algorithm. Private Sub Command1_Click()
Dim nfile As Long
Dim filelength As Long ' length of document
Dim filedata As Variant ' file data read from document
Dim crypt As New ChilkatCrypt2
crypt.UnlockComponent "UnlockCode"
' Read the file as binary data.
nfile = FreeFile
Open "hashThis.txt" For Binary As nfile
filelength = LOF(nfile)
filedata = InputB(filelength, nfile)
' The hash length can be 128, 160, 192, 224, or 256 bits.
crypt.HashAlgorithm = "haval"
' Set the length of the hash to 128 bits.
crypt.KeyLength = 128
' Provide output as a hex-encoded string.
crypt.EncodingMode = "hex"
Text1.Text = crypt.HashBytesENC(filedata)
' Do it again, but return the result as a base-64 encoded string.
crypt.EncodingMode = "base64"
Text2.Text = crypt.HashBytesENC(filedata)
End Sub
|
Need a specific example? Send a request to support@chilkatsoft.com
© 2000-2008 Chilkat Software, Inc. All Rights Reserved.