VBScript Examples

ChilkatHOMEAndroid™ASPVisual BasicVB.NETC#iOS (IPhone)Objective-CC++CMFCDelphiFoxProJavaPerl
PHP ExtensionPHP ActiveXPythonPowerShellRubySQL ServerVBScript

VBScript Examples

Bounced Mail
Bz2
Character Encoding
Digital Certificates
CSV
Digital Signatures
Email
FTP
HTML Conversion
HTTP
IMAP
Encryption
MHT / HTML Email
POP3
PFX
RSA
S/MIME
SFTP
SMTP
Socket
Spider
SSH
SSH Key
SSH Tunnel
String
Tar
Upload
XML
XMP
Zip Compression
Self-Extractor

More Examples...
Amazon S3
Email Object
DKIM / DomainKey
NTLM
FileAccess
Byte Array
RSS
Atom
Service
PPMD
Deflate
DH Key Exchange
DSA
Bzip2
LZW

 

 

 

 

 

 

 

ARC4 Encryption (ARCFOUR)

Download Chilkat Crypt ActiveX

Demonstrates simple ARC4 encryption to match some simple test vectors published by Wikipedia. ARC4 is a fast stream cipher supporting key lengths from 8 to 2048 bits (i.e. from 1 to 256 bytes). It is not a block cipher, so there is no padding, no modes, and no initialization vector.

Dim fso, outFile
Set fso = CreateObject("Scripting.FileSystemObject")
Set outFile = fso.CreateTextFile("output.txt", True)

set crypt = CreateObject("Chilkat.Crypt2")

success = crypt.UnlockComponent("Anything for 30-day trial")
If (success <> 1) Then
    MsgBox "Crypt component unlock failed"
    WScript.Quit
End If

'  Set the encryption algorithm to ARC4:
crypt.CryptAlgorithm = "arc4"

'  We want the encrypted output to be a hex-encoded string.
crypt.EncodingMode = "hex"

'  Encrypt some test vectors from Wikipedia:

'  The key length (in bits) is equal to the number of us-ascii
'  bytes in our key string * 8.

' ARC4( "Key", "Plaintext" ) == BBF316E8D940AF0AD3
crypt.KeyLength = 24
crypt.SetEncodedKey "Key","ascii"
cipherText = crypt.EncryptStringENC("Plaintext")
outFile.WriteLine(cipherText)
plainText = crypt.DecryptStringENC(cipherText)
outFile.WriteLine(plainText)

' ARC4( "Wiki", "pedia" ) == 1021BF0420
crypt.KeyLength = 32
crypt.SetEncodedKey "Wiki","ascii"
cipherText = crypt.EncryptStringENC("pedia")
outFile.WriteLine(cipherText)
plainText = crypt.DecryptStringENC(cipherText)
outFile.WriteLine(plainText)

' ARC4( "Secret", "Attack at dawn" ) == 45A01F645FC35B383552544B9BF5
crypt.KeyLength = 48
crypt.SetEncodedKey "Secret","ascii"
cipherText = crypt.EncryptStringENC("Attack at dawn")
outFile.WriteLine(cipherText)
plainText = crypt.DecryptStringENC(cipherText)
outFile.WriteLine(plainText)

'  Note: The call to SetEncodedKey serves to set the key
'  to the us-ascii bytes of the string.

outFile.Close

© 2000-2010 Chilkat Software, Inc. All Rights Reserved.

Mail Component · XML Parser