About
GeCipher256 class provides means to encrypt and decrypt data.
- Warning
- This class only uses a simple and insecure scrambling. Use advanced algorithms like AES if security is really needed.
-
For encryption using the Maxon API see Stream Conversions Manual.
Char plainText[] =
"O brave new world / That has such people in't!";
const Char key[32] = {
'7',
'c',
'3',
'0',
'e',
'0',
'0',
'b',
'b',
'6',
'2',
'7',
'1',
'4',
'9',
'5' };
GeCipher256 cipher;
if (!cipher.Open(
key, keyLength,
false))
return maxon::UnexpectedError(
MAXON_SOURCE_LOCATION,
"The function exited unexpectedly on initializing GeCipher256"_s);
cipher.Encrypt(plainText,
length);
Char plainTextEncoded[
sizeof(plainText) + 1];
plainTextEncoded[sizeof(plainText)] = 0;
cipher.Decrypt(plainText,
length);
cipher.Close();
PyObject * key
Definition: abstract.h:289
Definition: string.h:1287
void * str
Definition: bytesobject.h:77
#define MAXON_SOURCE_LOCATION
Definition: memoryallocationbase.h:69
#define ApplicationOutput(formatString,...)
Definition: debugdiagnostics.h:204
PyWideStringList Py_ssize_t length
Definition: initconfig.h:448
maxon::Char Char
Definition: ge_sys_math.h:47
maxon::Int32 Int32
Definition: ge_sys_math.h:51
void CopyMem(const void *s, void *d, Int size)
Definition: c4d_memory.h:65
Create
A GeCipher256 instance can be created by simply defining it (e.g. as a local variable). No special allocation is needed.
Use
- GeCipher256::Open(): Initializes the cipher engine with the specified key.
- GeCipher256::Close(): Closes the cipher engine.
Encryption / Decryption
- GeCipher256::Encrypt(): Encrypts an array.
- GeCipher256::Decrypt(): Decrypts an array.
Further Reading