Chilkat
HOME
Android™
ASP
Visual Basic
VB.NET
C#
iOS (IPhone)
Objective-C
C++
C
MFC
Delphi
FoxPro
Java
Perl
PHP Extension
PHP ActiveX
Python
PowerShell
Ruby
SQL Server
VBScript
VB source to AES Encrypt String - ANSI String vs. Unicode String
This example demonstrates two ways to encrypt strings. The first encrypts an ANSI string (1 byte per character) while the second encrypts a Unicode string (2 bytes per character). Private Sub Form_Load() Dim aes As ChilkatCrypt2 Set aes = New ChilkatCrypt2 ' Setup the encryption object for 128-bit AES (Rijndael) encryption aes.UnlockComponent "UnlockCode" aes.CryptAlgorithm = "rijndael" aes.KeyLength = 128 aes.SecretKey = aes.GenerateSecretKey("MyPassword") ' Use base64 encoding for output strings. aes.EncodingMode = "Base64" ' Encrypt an ANSI string (1-byte per character) aes.Charset = "ANSI" Text1.Text = aes.EncryptStringENC(InText) ' Encrypt a Unicode string (2-bytes per character) aes.Charset = "Unicode" Text2.Text = aes.EncryptStringENC(InText) Set aes = Nothing End Sub
|
© 2000-2012 Chilkat Software, Inc. All Rights Reserved.