Namespace: dmCrypt
Language: C++
Type: Defold C++
File: crypt.h
Source: engine/dlib/src/dmsdk/dlib/crypt.h
Include: dmsdk/dlib/crypt.h
Various hash and encode/decode functions.
Type: ENUM encryption algorithm enumeration
Members
dmCrypt::ALGORITHM_XTEAType: FUNCTION Base64 decode a buffer
Notes
Parameters
src (const uint8_t*) - The source data to encodesrc_len (uint32_t) - key The length of source data in bytesdst (uint8_t*) - The destination bufferdst_len[in,out] (uint32_t*) - In: The length of the destination in bytes. Out: The length of the decoded string.Returns
success (bool) - true if the decoding went okType: FUNCTION Base64 encode a buffer
Notes
Parameters
src (const uint8_t*) - The source data to encodesrc_len (uint32_t) - key The length of source data in bytesdst (uint8_t*) - The destination bufferdst_len[in,out] (uint32_t*) - In: The length of the destination in bytes. Out: The length of the encoded string.Returns
success (bool) - true if the encoding went okType: FUNCTION Decrypt data in place
Parameters
algo (dmCrypt::Algorithm) - algorithmdata (const uint8_t*) - datadatalen (uint32_t) - data length in byteskey (const uint8_t*) - keykeylen (uint32_t) - key lengthReturns
result (dmCrypt::Result) - the decryption resultType: FUNCTION Encrypt data in place
Parameters
algo (dmCrypt::Algorithm) - algorithmdata (const uint8_t*) - datadatalen (uint32_t) - data length in byteskey (const uint8_t*) - keykeylen (uint32_t) - key lengthReturns
result (dmCrypt::Result) - the encryption resultType: FUNCTION Hash buffer using MD5
Parameters
buf (const uint8_t*) - The source data to hashbuflen (uint32_t) - key The length of source data in bytesdigest (const uint8_t*) - The destination buffer (16 bytes)Type: FUNCTION Hash buffer using SHA1
Parameters
buf (const uint8_t*) - The source data to hashbuflen (uint32_t) - The length of source data in bytesdigest (uint8_t*) - The destination buffer (20 bytes)Type: FUNCTION Hash buffer using SHA256
Parameters
buf (const uint8_t*) - The source data to hashbuflen (uint32_t) - key The length of source data in bytesdigest (uint8_t*) - The destination buffer (32 bytes)Type: FUNCTION Hash buffer using SHA512
Parameters
buf (const uint8_t*) - The source data to hashbuflen (uint32_t) - key The length of source data in bytesdigest (uint8_t*) - The destination buffer (64 bytes)Type: ENUM result enumeration
Members
dmCrypt::RESULT_OK - = 0dmCrypt::RESULT_ERROR - = 1