Unit Crypto
From Ultibo.org
Return to Unit Reference
Contents
[hide]Description
Ultibo Crypto interface unit
To be documented
Constants
[Expand]
Crypto cipher algorithms
CRYPTO_CIPHER_ALG_*
[Expand]
Crypto cipher modes
CRYPTO_CIPHER_MODE_*
[Expand]
Crypto hash algorithms
CRYPTO_HASH_ALG_*
[Expand]
AES block size
AES_BLOCK_*
[Expand]
AES key size
AES_KEY_*
[Expand]
DES block size
DES_BLOCK_*
[Expand]
DES key size
DES_KEY_*
[Expand]
DES key type
DES_KEYTYPE_*
[Expand]
3DES block size
DES3_BLOCK_*
[Expand]
3DES key size
DES3_KEY_*
[Expand]
SHA1 constants
SHA1_*
[Expand]
MIME64 constants
MIME64_*
Type definitions
To be documented
Public variables
Crypto specific variables
CryptoInitialized:Boolean;
|
MIME64 variables
MIME64DecodingTable:String;
|
Function declarations
Initialization functions
Crypto functions
[Expand]
function HashCreate(Algorithm:LongWord; Key:Pointer; KeySize:LongWord):PHashContext;
Description: Initialize a hash context based on an algorithm and an optional key
[Expand]
function HashDestroy(Context:PHashContext):Boolean;
Description: Free a hash context allocated by HashCreate
[Expand]
function HashUpdate(Context:PHashContext; Data:Pointer; Size:LongWord):Boolean;
Description: Add a block of data to a hash context
[Expand]
function HashFinish(Context:PHashContext; Digest:Pointer; Size:LongWord):Boolean;
Description: Finalize a hash context and return the digest (Hash) value
[Expand]
function CipherCreate(Algorithm:LongWord; Vector,Key:Pointer; KeySize:LongWord):PCipherContext;
Description: Initialize a cipher context based on an algorithm and a key
[Expand]
function CipherDestroy(Context:PCipherContext):Boolean;
Description: Free a cipher context allocated by CipherCreate
[Expand]
function CipherEncrypt(Context:PCipherContext; Plain,Crypt:Pointer; Size:LongWord):Boolean;
Description: Encrypt a block of data using an existing cipher context
[Expand]
function CipherDecrypt(Context:PCipherContext; Crypt,Plain:Pointer; Size:LongWord):Boolean;
Description: Decrypt a block of data using an existing cipher context
MD5 functions
[Expand]
function MD5DigestData(Data:PMD5Block; Digest:PMD5Digest):Boolean;
Description: Generate a 128 bit MD5 digest (Hash) from the supplied data
[Expand]
function MD5DigestString(const Value:String; Digest:PMD5Digest):Boolean;
Description: Generate a 128 bit MD5 digest (Hash) from the supplied string value
[Expand]
function HMACMD5DigestData(const Key:String; Data:PMD5Block; Digest:PMD5Digest):Boolean;
Description: Generate an MD5 HMAC (Hashed Message Authentication Code) using the Key and Data
[Expand]
function HMACMD5DigestString(const Key,Value:String; Digest:PMD5Digest):Boolean;
Description: Generate an MD5 HMAC (Hashed Message Authentication Code) using the Key and Value
AES functions
[Expand]
function AESEncryptData(Key:Pointer; KeySize:LongWord; Vector,Plain,Crypt:Pointer; Size:LongWord):Boolean;
Description: To be documented
[Expand]
function AESDecryptData(Key:Pointer; KeySize:LongWord; Vector,Crypt,Plain:Pointer; Size:LongWord):Boolean;
Description: To be documented
DES functions
[Expand]
function DESEncryptData(Key:Pointer; KeySize:LongWord; Vector,Plain,Crypt:Pointer; Size:LongWord):Boolean;
Description: To be documented
[Expand]
function DESDecryptData(Key:Pointer; KeySize:LongWord; Vector,Crypt,Plain:Pointer; Size:LongWord):Boolean;
Description: To be documented
3DES functions
[Expand]
function DES3EncryptData(Key:Pointer; KeySize:LongWord; Vector,Plain,Crypt:Pointer; Size:LongWord):Boolean;
Description: To be documented
[Expand]
function DES3DecryptData(Key:Pointer; KeySize:LongWord; Vector,Crypt,Plain:Pointer; Size:LongWord):Boolean;
Description: To be documented
RC4 functions
[Expand]
function RC4EncryptData(Key:Pointer; KeySize:LongWord; Plain,Crypt:Pointer; Size,Start:LongWord):Boolean;
Description: Encrypt the supplied data with a key using the RC4 cipher algorithm
[Expand]
function RC4DecryptData(Key:Pointer; KeySize:LongWord; Crypt,Plain:Pointer; Size,Start:LongWord):Boolean; inline;
Description: Decrypt the supplied data with a key using the RC4 cipher algorithm
SHA1 functions
[Expand]
function SHA1DigestData(Data:PSHA1Block; Digest:PSHA1Digest):Boolean;
Description: Generate a 160 bit SHA1 digest (Hash) from the supplied data
[Expand]
function SHA1DigestString(const Value:String; Digest:PSHA1Digest):Boolean;
Description: Generate a 160 bit SHA1 digest (Hash) from the supplied string value
[Expand]
function HMACSHA1DigestData(const Key:String; Data:PSHA1Block; Digest:PSHA1Digest):Boolean;
Description: Generate a SHA1 HMAC (Hashed Message Authentication Code) using the Key and Data
[Expand]
function HMACSHA1DigestString(const Key,Value:String; Digest:PSHA1Digest):Boolean;
Description: Generate a SHA1 HMAC (Hashed Message Authentication Code) using the Key and Value
SHA256 functions
[Expand]
function SHA256DigestData(Data:PSHA256Block; Digest:PSHA256Digest):Boolean;
Description: Generate a 256 bit SHA256 digest (Hash) from the supplied data
[Expand]
function SHA256DigestString(const Value:String; Digest:PSHA256Digest):Boolean;
Description: Generate a 256 bit SHA256 digest (Hash) from the supplied string value
[Expand]
function HMACSHA256DigestData(const Key:String; Data:PSHA256Block; Digest:PSHA256Digest):Boolean;
Description: Generate a SHA256 HMAC (Hashed Message Authentication Code) using the Key and Data
[Expand]
function HMACSHA256DigestString(const Key,Value:String; Digest:PSHA256Digest):Boolean;
Description: Generate a SHA256 HMAC (Hashed Message Authentication Code) using the Key and Value
CRC functions
[Expand]
function CRC16CCITT(CRC:Word; Data:PByte; Size:LongWord):Word;
Description: To be documented
MIME64 functions
Crypto helper functions
[Expand]
procedure BytesToLE(Buffer:PByte; Count:LongWord);
Description: Change the byte order of count longwords in the supplied buffer to little endian
[Expand]
procedure BytesToBE(Buffer:PByte; Count:LongWord);
Description: Change the byte order of count longwords in the supplied buffer to big endian
[Expand]
procedure BEToLongWord(Value:LongWord; Buffer:PByte); inline;
Description: To be documented
MD5 helper functions
[Expand]
procedure MD5Init(var Context:TMD5Context);
Description: Initialize an MD5 context with constants
[Expand]
procedure MD5Update(var Context:TMD5Context; Data:Pointer; Size:LongWord);
Description: Add more bytes to the data buffer, add to the hash in 64 byte chunks
[Expand]
procedure MD5Final(var Context:TMD5Context; var Digest:TMD5Digest);
Description: Finalize the MD5 context by padding to a 64 Byte boundary, adding QWord count of bits processed and copying the hash to the digest
[Expand]
procedure MD5Transform(var Context:TMD5Context; Buffer:Pointer);
Description: The core MD5 algorithm, adds an additional 64 Bytes (16 LongWords) to the hash
AES helper functions
[Expand]
function AESKeySetup(Key:Pointer; KeySize:LongWord; AESKey:PAESKey):Boolean;
Description: To be documented
[Expand]
procedure AESEncryptBlock(Plain,Crypt:Pointer; AESKey:PAESKey);
Description: To be documented
[Expand]
procedure AESDecryptBlock(Crypt,Plain:Pointer; AESKey:PAESKey);
Description: To be documented
DES helper functions
[Expand]
procedure DESKey(Key:PByte; KeyType:LongWord; CryptKey:PDESKey);
Description: To be documented
[Expand]
function DESKeySetup(Key:Pointer; KeySize:LongWord; EncryptKey,DecryptKey:PDESKey):Boolean;
Description: To be documented
[Expand]
procedure DESEncryptBlock(Plain,Crypt:Pointer; EncryptKey:PDESKey);
Description: To be documented
[Expand]
procedure DESDecryptBlock(Crypt,Plain:Pointer; DecryptKey:PDESKey);
Description: To be documented
3DES helper functions
[Expand]
function DES3KeySetup(Key:Pointer; KeySize:LongWord; DES3Key:PDES3Key):Boolean;
Description: To be documented
[Expand]
procedure DES3EncryptBlock(Plain,Crypt:Pointer; DES3Key:PDES3Key);
Description: To be documented
[Expand]
procedure DES3DecryptBlock(Crypt,Plain:Pointer; DES3Key:PDES3Key);
Description: To be documented
SHA1 helper functions
[Expand]
procedure SHA1Init(var Context:TSHA1Context);
Description: Initialize a SHA1 context with constants
[Expand]
procedure SHA1Update(var Context:TSHA1Context; Data:Pointer; Size:LongWord);
Description: Add more bytes to the data buffer, add to the hash in 64 byte chunks
[Expand]
procedure SHA1Final(var Context:TSHA1Context; var Digest:TSHA1Digest);
Description: Finalize the SHA1 context by padding to a 64 Byte boundary, adding QWord count of bits processed and copying the hash to the digest
[Expand]
procedure SHA1Transform(var Context:TSHA1Context; Buffer:Pointer);
Description: The core SHA1 algorithm, adds an additional 64 Bytes (512 bits) to the hash
SHA256 helper functions
[Expand]
procedure SHA256Init(var Context:TSHA256Context);
Description: Initialize a SHA256 context with constants
[Expand]
procedure SHA256Process(var Context:TSHA256Context; Data:Pointer; Size:LongWord);
Description: Add more bytes to the data buffer, add to the hash in 64 byte chunks
[Expand]
procedure SHA256Complete(var Context:TSHA256Context; var Digest:TSHA256Digest);
Description: Finalize the SHA256 context by padding to a 64 Byte boundary, adding QWord count of bits processed and copying the hash to the digest
[Expand]
procedure SHA256Compress(var Context:TSHA256Context; Buffer:Pointer);
Description: The core SHA256 algorithm, adds an additional 64 Bytes (512 bits) to the hash
MIME64 helper functions
Return to Unit Reference