These functions allow you to encrypt or digest strings. The header file Encrypt.h
only declares functions, so this chapter only consists of a single section:
Encrypt Functions and Macros
The header file Encrypt.h
declares the API that this chapter describes.
Encrypt Functions and Macros
EncDES Function
Purpose
Perform a reversible encryption or decryption of an 8-byte string using an 8-byte key.
Declared In
Encrypt.h
Prototype
status_t EncDES ( uint8_t*srcP
, uint8_t*keyP
, uint8_t*dstP
, Booleanencrypt
)
Parameters
-
→ srcP
- The 8-byte string to be encrypted.
-
→ keyP
- The 8-byte key with which to encrypt the string in
srcP
. -
← dstP
- The 8-byte encrypted result.
-
→ encrypt
- Pass
true
to encrypt,false
to decrypt.
Returns
errNone
if the operation completed successfully, or one of the error codes listed under "CPM Library Error Codes" otherwise.
EncDigestMD4 Function
Purpose
Digest a string of bytes to produce a 128-bit result using the MD4 algorithm.
Declared In
Encrypt.h
Prototype
status_t EncDigestMD4 ( uint8_t*strP
, uint16_tstrLen
, uint8_tdigestP[16]
)
Parameters
-
→ strP
- The string to be digested.
-
→ strLen
- The length of the string passed in
strP
. -
← digestP[16]
- The resulting 128-bit (16 byte) digest.
Returns
errNone
if the operation completed successfully, or one of the error codes listed under "CPM Library Error Codes" otherwise.
EncDigestMD5 Function
Purpose
Digest a string of bytes to produce a 128-bit result using the MD5 algorithm.
Declared In
Encrypt.h
Prototype
status_t EncDigestMD5 ( uint8_t*strP
, uint16_tstrLen
, uint8_tdigestP[16]
)
Parameters
-
→ strP
- The string to be digested.
-
→ strLen
- The length of the string passed in
strP
. -
← digestP[16]
- The resulting 128-bit (16 byte) digest.
Returns
errNone
if the operation completed successfully, or one of the error codes listed under "CPM Library Error Codes" otherwise.