Platforms to show: All Mac Windows Linux Cross-Platform

Back to BlowfishMBS class.

BlowfishMBS.Decrypt(key as string, data as string) as string

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Encryption and Hash MBS Encryption Plugin 8.4 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Decrypts the data using blowfish and the given key.
Example
dim s as string

// create string with known encoding so we can later define encoding after decryption!
s=ConvertEncoding("Hello",Encodings.UTF8)

// encrypt with a key
s=BlowfishMBS.Encrypt("MyKey",s)

// encoding is not set for the result string, still RB can guess the encoding when displaying
MsgBox s

// decrypt with same key
s=BlowfishMBS.Decrypt("MyKey",s)

// encoding is not set for the result string, so change it back:
s=DefineEncoding(s,encodings.UTF8)

// show original Hello
MsgBox s

This is our convenience function to encode a string quickly. Using CFB64 mode and an all zero initializing vector.
If the lenb(result) is zero and lenb(data) is not zero, the memory was not sufficient.

Key can have any length, but 32 bytes (256 bits) are quite good.
The length of data is limited by the amount of available memory.

See also:

BlowfishMBS.Encrypt(key as string, data as string) as string

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Encryption and Hash MBS Encryption Plugin 8.4 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Encrypts the data using blowfish and the given key.
Example
dim v as string = "Hello World, this is just a test string"

// encrypt CFB64 with BlowfishMBS
dim b as new BlowfishMBS
dim Key as string = "1234567812345678"
dim r as string = b.Encrypt( key , v )
dim h as string = EncodeHex( r )

// and decrypt with OpenSSL
dim c as CipherMBS = CipherMBS.bf_cfb64

c.DecryptInit key
dim d as string = c.ProcessString(r)
d = d + c.FinalizeAsString

Break // see in debugger, v and d have same content

This is our convenience function to decode a string quickly. Using CFB64 mode and an all zero initializing vector.
If the lenb(result) is zero and lenb(data) is not zero, the memory was not sufficient.

Key can have any length, but 32 bytes (256 bits) are quite good.
The length of data is limited by the amount of available memory.

Returned string does not contain text, but binary data.
Please do not store in text fields in database without using EncodeHex or EncodeBase64 to make it a text string.

See also:

The items on this page are in the following plugins: MBS Encryption Plugin.


The biggest plugin in space...