Here is a quick example using VB6 to encrypt/decrypt a credit card number:
Dim crypt2 As New ChilkatCrypt2
crypt2.UnlockComponent "30-day trial"
crypt2.CryptAlgorithm = "aes"
crypt2.EncodingMode = "base64″
‘ The VB6 string is Unicode, so make sure we are encrypting 1 byte/char…
crypt2.Charset = "ansi"
‘ Set a binary secret key. Make sure to set the KeyLength prior to this.
‘ We use the GenerateSecretKey method to convert an arbitrary password string
‘ to a binary secret key with the appropriate number of bits (128)
crypt2.KeyLength = 128
crypt2.SecretKey = crypt2.GenerateSecretKey("myPassword")
Dim ccNum As String
ccNum = "3121129011220090″ ‘ 16-digit credit card number (not a real one of course…)
‘ Encrypt and return as base64 string
‘ The encrypted string is about 42 characters
‘ 16 characters of encrypted data + 16 characters of padding
‘ which are base64 encoded, which expands data by approx 4/3rds.
Text1.Text = crypt2.EncryptStringENC(ccNum)
‘ Decrypt from base64 string.
Text2.Text = crypt2.DecryptStringENC(Text1.Text)