Sample code for 30+ languages & platforms
Xbase++

Example: Crypt2.EncryptSb method

Demonstrates how to call the EncryptSb method.

Chilkat Xbase++ Downloads

Xbase++
LOCAL nSuccess
LOCAL oCrypt
LOCAL oBdEncrypted
LOCAL oSbPlainText

nSuccess := 0

oCrypt := CreateObject("Chilkat.Crypt2")

oBdEncrypted := CreateObject("Chilkat.BinData")
oSbPlainText := CreateObject("Chilkat.StringBuilder")

oSbPlainText:Append("Text to be encrypted")

//  ...
//  Set the secret key ...
//  Set properties such as CryptAlgorithm, CipherMode, PaddingScheme, KeyLength
//  Set the IV if needed ...
//  ...

oCrypt:Charset := "utf-8"

nSuccess := oCrypt:EncryptSb(oSbPlainText, oBdEncrypted)
IF (nSuccess == 0)
    ? oCrypt:LastErrorText
    oCrypt:destroy()
    oBdEncrypted:destroy()
    oSbPlainText:destroy()
    RETURN
ENDIF

oCrypt:destroy()
oBdEncrypted:destroy()
oSbPlainText:destroy()