Platforms to show: All Mac Windows Linux Cross-Platform

Back to TwofishMBS module.

TwofishMBS.DecryptCBC(Key as MemoryBlock, InputData as MemoryBlock, IV as MemoryBlock) as MemoryBlock

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Encryption and Hash MBS Encryption Plugin 17.0 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Decrypts with CBC mode and memoryblocks.
Example
// key is 16 bytes, so 128 bit
Var key as MemoryBlock = "Hello World 1234"
Var IV as MemoryBlock = "1234567812345678" // 16 byte IV

// some UTF-8 input
Var InputText as string = "Just a test. äöü"
Var InputData as MemoryBlock = ConvertEncoding(InputText, encodings.UTF8)

Var EncryptedData as MemoryBlock = TwofishMBS.EncryptCBC(key, InputData, IV)
Var DecryptedData as MemoryBlock = TwofishMBS.DecryptCBC(key, encryptedData, IV)

// restore encoding
Var Decryptedtext as String = DefineEncoding(DecryptedData, encodings.UTF8)

// remove training zeros
Var p as Integer = instrb(Decryptedtext, chrb(0))
if p > 0 then
Decryptedtext = leftb(Decryptedtext, p-1)
end if

// check
if Decryptedtext = InputText then
MsgBox "OK"
else
MsgBox "Failed"
end if

IV can be nil for using zeros.
IV size should be 16 bytes.
Key length should be 16 for 128bit, 24 for 192 bit or 32 for 256 bit.
InputData should be aligned to 16byte size. Else the plugin will fill up with zero bytes.

See also:

TwofishMBS.DecryptCBC(Key as String, InputData as String, IV as String) as String

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Encryption and Hash MBS Encryption Plugin 17.0 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Decrypts with CBC mode and strings.
Example
// key is 16 bytes, so 128 bit
Var key as String = "Hello World 1234"
Var IV as String = "1234567812345678" // 16 byte IV

// some UTF-8 input
Var InputText as string = "Just a test. äöü"
Var InputData as String = ConvertEncoding(InputText, encodings.UTF8)

Var EncryptedData as String = TwofishMBS.EncryptCBC(key, InputData, IV)
Var DecryptedData as String = TwofishMBS.DecryptCBC(key, encryptedData, IV)

// restore encoding
Var Decryptedtext as String = DefineEncoding(DecryptedData, encodings.UTF8)

// remove training zeros
Var p as Integer = instrb(Decryptedtext, chrb(0))
if p > 0 then
Decryptedtext = leftb(Decryptedtext, p-1)
end if

// check
if Decryptedtext = InputText then
MsgBox "OK"
else
MsgBox "Failed"
end if

IV can be empty for using zeros.
IV size should be 16 bytes.
Key length should be 16 for 128bit, 24 for 192 bit or 32 for 256 bit.
InputData should be aligned to 16byte size. Else the plugin will fill up with zero bytes.

See also:

TwofishMBS.DecryptECB(Key as MemoryBlock, InputData as MemoryBlock) as MemoryBlock

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Encryption and Hash MBS Encryption Plugin 17.0 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Decrypts with ECB mode and memoryblocks.
Example
// key is 16 bytes, so 128 bit
Var key as MemoryBlock = "Hello World 1234"

// some UTF-8 input
Var InputText as string = "Just a test. äöü"
Var InputData as MemoryBlock = ConvertEncoding(InputText, encodings.UTF8)

Var EncryptedData as MemoryBlock = TwofishMBS.EncryptECB(key, InputData)
Var DecryptedData as MemoryBlock = TwofishMBS.DecryptECB(key, encryptedData)

// restore encoding
Var Decryptedtext as String = DefineEncoding(DecryptedData, encodings.UTF8)

// remove training zeros
Var p as Integer = instrb(Decryptedtext, chrb(0))
if p > 0 then
Decryptedtext = leftb(Decryptedtext, p-1)
end if

// check
if Decryptedtext = InputText then
MsgBox "OK"
else
MsgBox "Failed"
end if

Key length should be 16 for 128bit, 24 for 192 bit or 32 for 256 bit.
InputData should be aligned to 16byte size. Else the plugin will fill up with zero bytes.

See also:

TwofishMBS.DecryptECB(Key as String, InputData as String) as String

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Encryption and Hash MBS Encryption Plugin 17.0 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Decrypts with ECB mode and strings.
Example
// key is 16 bytes, so 128 bit
Var key as string = "Hello World 1234"

// some UTF-8 input
Var InputData as string = "Just a test. äöü"
InputData = ConvertEncoding(InputData, encodings.UTF8)

Var Encrypted as string = TwofishMBS.EncryptECB(key, InputData)
Var Decrypted as string = TwofishMBS.DecryptECB(key, encrypted)

// restore encoding
Decrypted = DefineEncoding(Decrypted, encodings.UTF8)

// remove training zeros
Var p as Integer = instrb(Decrypted, chrb(0))
if p > 0 then
Decrypted = leftb(Decrypted, p-1)
end if

// check
if Decrypted = InputData then
MsgBox "OK"
else
MsgBox "Failed"
end if

Key length should be 16 for 128bit, 24 for 192 bit or 32 for 256 bit.
InputData should be aligned to 16byte size. Else the plugin will fill up with zero bytes.

See also:

TwofishMBS.EncryptCBC(Key as MemoryBlock, InputData as MemoryBlock, IV as MemoryBlock) as MemoryBlock

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Encryption and Hash MBS Encryption Plugin 17.0 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Encrypts with CBC mode and memoryblocks.
Example
// key is 16 bytes, so 128 bit
Var key as MemoryBlock = "Hello World 1234"
Var IV as MemoryBlock = "1234567812345678" // 16 byte IV

// some UTF-8 input
Var InputText as string = "Just a test. äöü"
Var InputData as MemoryBlock = ConvertEncoding(InputText, encodings.UTF8)

Var EncryptedData as MemoryBlock = TwofishMBS.EncryptCBC(key, InputData, IV)
Var DecryptedData as MemoryBlock = TwofishMBS.DecryptCBC(key, encryptedData, IV)

// restore encoding
Var Decryptedtext as String = DefineEncoding(DecryptedData, encodings.UTF8)

// remove training zeros
Var p as Integer = instrb(Decryptedtext, chrb(0))
if p > 0 then
Decryptedtext = leftb(Decryptedtext, p-1)
end if

// check
if Decryptedtext = InputText then
MsgBox "OK"
else
MsgBox "Failed"
end if

IV can be nil for using zeros.
IV size should be 16 bytes.
Key length should be 16 for 128bit, 24 for 192 bit or 32 for 256 bit.
InputData should be aligned to 16byte size. Else the plugin will fill up with zero bytes.

See also:

TwofishMBS.EncryptCBC(Key as String, InputData as String, IV as String) as String

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Encryption and Hash MBS Encryption Plugin 17.0 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Encrypts with CBC mode and string.
Example
// key is 16 bytes, so 128 bit
Var key as String = "Hello World 1234"
Var IV as String = "1234567812345678" // 16 byte IV

// some UTF-8 input
Var InputText as string = "Just a test. äöü"
Var InputData as String = ConvertEncoding(InputText, encodings.UTF8)

Var EncryptedData as String = TwofishMBS.EncryptCBC(key, InputData, IV)
Var DecryptedData as String = TwofishMBS.DecryptCBC(key, encryptedData, IV)

// restore encoding
Var Decryptedtext as String = DefineEncoding(DecryptedData, encodings.UTF8)

// remove training zeros
Var p as Integer = instrb(Decryptedtext, chrb(0))
if p > 0 then
Decryptedtext = leftb(Decryptedtext, p-1)
end if

// check
if Decryptedtext = InputText then
MsgBox "OK"
else
MsgBox "Failed"
end if

IV can be empty for using zeros.
IV size should be 16 bytes.
Key length should be 16 for 128bit, 24 for 192 bit or 32 for 256 bit.
InputData should be aligned to 16byte size. Else the plugin will fill up with zero bytes.

See also:

TwofishMBS.EncryptECB(Key as MemoryBlock, InputData as MemoryBlock) as MemoryBlock

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Encryption and Hash MBS Encryption Plugin 17.0 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Encrypts with ECB mode and memoryblocks.
Example
// key is 16 bytes, so 128 bit
Var key as MemoryBlock = "Hello World 1234"

// some UTF-8 input
Var InputText as string = "Just a test. äöü"
Var InputData as MemoryBlock = ConvertEncoding(InputText, encodings.UTF8)

Var EncryptedData as MemoryBlock = TwofishMBS.EncryptECB(key, InputData)
Var DecryptedData as MemoryBlock = TwofishMBS.DecryptECB(key, encryptedData)

// restore encoding
Var Decryptedtext as String = DefineEncoding(DecryptedData, encodings.UTF8)

// remove training zeros
Var p as Integer = instrb(Decryptedtext, chrb(0))
if p > 0 then
Decryptedtext = leftb(Decryptedtext, p-1)
end if

// check
if Decryptedtext = InputText then
MsgBox "OK"
else
MsgBox "Failed"
end if

Key length should be 16 for 128bit, 24 for 192 bit or 32 for 256 bit.
InputData should be aligned to 16byte size. Else the plugin will fill up with zero bytes.

See also:

TwofishMBS.EncryptECB(Key as String, InputData as String) as String

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Encryption and Hash MBS Encryption Plugin 17.0 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Encrypts with ECB mode and strings.
Example
// key is 16 bytes, so 128 bit
Var key as string = "Hello World 1234"

// some UTF-8 input
Var InputData as string = "Just a test. äöü"
InputData = ConvertEncoding(InputData, encodings.UTF8)

Var Encrypted as string = TwofishMBS.EncryptECB(key, InputData)
Var Decrypted as string = TwofishMBS.DecryptECB(key, encrypted)

// restore encoding
Decrypted = DefineEncoding(Decrypted, encodings.UTF8)

// remove training zeros
Var p as Integer = instrb(Decrypted, chrb(0))
if p > 0 then
Decrypted = leftb(Decrypted, p-1)
end if

// check
if Decrypted = InputData then
MsgBox "OK"
else
MsgBox "Failed"
end if

Key length should be 16 for 128bit, 24 for 192 bit or 32 for 256 bit.
InputData should be aligned to 16byte size. Else the plugin will fill up with zero bytes.

See also:

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


The biggest plugin in space...