Visual Basic Examples

ChilkatHOMEASPVisual BasicVB.NETC#Visual C++CMFCDelphiFoxProJavaPerlPHPPythonRubySQL ServerVBScript

VB Examples

Bounced Mail
Character Encoding
Digital Certificates
Digital Signatures
Email
FTP
HTML-to-XML
HTTP
IMAP
Encryption
MHT / HTML Email
RSA Encryption
S/MIME
Socket
Spider
String
Tar
Unicode
Upload
XML
XMP
Zip Compression

More Examples...
Email Object
POP3
SMTP
RSS
Atom
Self-Extractor


VB Strings
VB Byte Array

Unreleased...
Service
PPMD
Deflate
Bzip2
LZW
Bz2
DH Key Exchange
DSA
Icon

 

 

 

 

 

 

 

SHA-1 Hash

Download Chilkat Crypt ActiveX

Visual Basic sample code to create a SHA-1 hash of a file.

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 "Anything for 30-day trial"
    
    ' Set the hash algorithm
    crypt.HashAlgorithm = "sha-1"
    
    ' Read the file as binary data.
    nfile = FreeFile
    Open "hashThis.txt" For Binary As nfile
    filelength = LOF(nfile)
    filedata = InputB(filelength, nfile)
    
    ' 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.