Difference between revisions of "Unit Crypto"
Line 216: | Line 216: | ||
---- | ---- | ||
− | '' | + | |
+ | '''MD5 digest''' | ||
+ | |||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"> | ||
+ | <code>PMD5Digest = ^TMD5Digest;</code> | ||
+ | |||
+ | <code>TMD5Digest = array[0..15] of Byte;</code> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | | | ||
+ | | style="width: 50%;"| | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | |||
+ | '''MD5 block''' | ||
+ | |||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"> | ||
+ | <code>PMD5Block = ^TMD5Block;</code> | ||
+ | |||
+ | <code>TMD5Block = record</code> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | | <code>Data:Pointer;</code> | ||
+ | | style="width: 50%;"| | ||
+ | |- | ||
+ | | <code>Size:LongWord;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>Next:PMD5Block;</code> | ||
+ | | | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | |||
+ | '''MD5 context''' | ||
+ | |||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"> | ||
+ | <code>PMD5Context = ^TMD5Context;</code> | ||
+ | |||
+ | <code>TMD5Context = record</code> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | | <code>Data:array[0..63] of Byte;</code> | ||
+ | | style="width: 50%;"| | ||
+ | |- | ||
+ | | <code>Buffer:array[0..3] of LongWord;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>Count:QWord;</code> | ||
+ | | | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | |||
+ | '''MD5 byte buffer''' | ||
+ | |||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"> | ||
+ | <code>PMD5ByteBuffer = ^TMD5ByteBuffer;</code> | ||
+ | |||
+ | <code>TMD5ByteBuffer = array[0..63] of Byte;</code> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | | | ||
+ | | style="width: 50%;"| | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | |||
+ | '''MD5 long buffer''' | ||
+ | |||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"> | ||
+ | <code>PMD5LongBuffer = ^TMD5LongBuffer;</code> | ||
+ | |||
+ | <code>TMD5LongBuffer = array[0..15] of LongWord;</code> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | | | ||
+ | | style="width: 50%;"| | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | |||
+ | '''AES key''' | ||
+ | |||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"> | ||
+ | <code>PAESKey = ^TAESKey;</code> | ||
+ | |||
+ | <code>TAESKey = record</code> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | | <code>Rounds:LongWord;</code> | ||
+ | | style="width: 50%;"| | ||
+ | |- | ||
+ | | <code>EncryptKey:array[0..59] of LongWord;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>DecryptKey:array[0..59] of LongWord;</code> | ||
+ | | | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | |||
+ | '''AES context''' | ||
+ | |||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"> | ||
+ | <code>PAESContext = ^TAESContext;</code> | ||
+ | |||
+ | <code>TAESContext = record</code> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | | <code>AESKey:TAESKey;</code> | ||
+ | | style="width: 50%;"| | ||
+ | |- | ||
+ | | <code>CBC:array[0..AES_BLOCK_SIZE - 1] of Byte;</code> | ||
+ | | | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | |||
+ | '''DES key''' | ||
+ | |||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"> | ||
+ | <code>PDESKey = ^TDESKey;</code> | ||
+ | |||
+ | <code>TDESKey = array[0..31] of LongWord;</code> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | | | ||
+ | | style="width: 50%;"| | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | |||
+ | '''DES context''' | ||
+ | |||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"> | ||
+ | <code>PDESContext = ^TDESContext;</code> | ||
+ | |||
+ | <code>TDESContext = record</code> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | | <code>EncryptKey:TDESKey;</code> | ||
+ | | style="width: 50%;"| | ||
+ | |- | ||
+ | | <code>DecryptKey:TDESKey;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>CBC:array[0..DES_BLOCK_SIZE - 1] of Byte;</code> | ||
+ | | | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | |||
+ | '''3DES key''' | ||
+ | |||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"> | ||
+ | <code>PDES3Key = ^TDES3Key;</code> | ||
+ | |||
+ | <code>TDES3Key = record</code> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | | <code>EncryptKey:array[0..2] of TDESKey;</code> | ||
+ | | style="width: 50%;"| | ||
+ | |- | ||
+ | | <code>DecryptKey:array[0..2] of TDESKey;</code> | ||
+ | | | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | |||
+ | '''3DES context''' | ||
+ | |||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"> | ||
+ | <code>PDES3Context = ^TDES3Context;</code> | ||
+ | |||
+ | <code>TDES3Context = record</code> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | | <code>DES3Key:TDES3Key;</code> | ||
+ | | style="width: 50%;"| | ||
+ | |- | ||
+ | | <code>CBC:array[0..DES3_BLOCK_SIZE - 1] of Byte;</code> | ||
+ | | | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | |||
+ | '''RC4 state''' | ||
+ | |||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"> | ||
+ | <code>PRC4State = ^TRC4State;</code> | ||
+ | |||
+ | <code>TRC4State = array[0..255] of Byte;</code> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | | | ||
+ | | style="width: 50%;"| | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | |||
+ | '''RC4 context''' | ||
+ | |||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"> | ||
+ | <code>PRC4Context = ^TRC4Context;</code> | ||
+ | |||
+ | <code>TRC4Context = record</code> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | | <code>Key:array[0..31] of Byte;</code> | ||
+ | | style="width: 50%;"| | ||
+ | |- | ||
+ | | <code>KeySize:LongWord;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>Start:LongWord;</code> | ||
+ | | | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | |||
+ | '''SHA1 digest''' | ||
+ | |||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"> | ||
+ | <code>PSHA1Digest = ^TSHA1Digest;</code> | ||
+ | |||
+ | <code>TSHA1Digest = array[0..19] of Byte;</code> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | | | ||
+ | | style="width: 50%;"| | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | |||
+ | '''SHA1 block''' | ||
+ | |||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"> | ||
+ | <code>PSHA1Block = ^TSHA1Block;</code> | ||
+ | |||
+ | <code>TSHA1Block = record</code> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | | <code>Data:Pointer;</code> | ||
+ | | style="width: 50%;"| | ||
+ | |- | ||
+ | | <code>Size:LongWord;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>Next:PSHA1Block;</code> | ||
+ | | | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | |||
+ | '''SHA1 context''' | ||
+ | |||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"> | ||
+ | <code>PSHA1Context = ^TSHA1Context;</code> | ||
+ | |||
+ | <code>TSHA1Context = record</code> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | | <code>Data:array[0..63] of Byte;</code> | ||
+ | | style="width: 50%;"| | ||
+ | |- | ||
+ | | <code>State:array[0..4] of LongWord;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>Count:QWord;</code> | ||
+ | | | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | |||
+ | '''SHA1 byte buffer''' | ||
+ | |||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"> | ||
+ | <code>PSHA1ByteBuffer = ^TSHA1ByteBuffer;</code> | ||
+ | |||
+ | <code>TSHA1ByteBuffer = array[0..63] of Byte;</code> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | | | ||
+ | | style="width: 50%;"| | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | |||
+ | '''SHA1 long buffer''' | ||
+ | |||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"> | ||
+ | <code>PSHA1LongBuffer = ^TSHA1LongBuffer;</code> | ||
+ | |||
+ | <code>TSHA1LongBuffer = array[0..15] of LongWord;</code> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | | | ||
+ | | style="width: 50%;"| | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | |||
+ | |||
+ | '''SHA256 digest''' | ||
+ | |||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"> | ||
+ | <code>PSHA256Digest = ^TSHA256Digest;</code> | ||
+ | |||
+ | <code>TSHA256Digest = array[0..31] of Byte;</code> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | | | ||
+ | | style="width: 50%;"| | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | |||
+ | '''SHA256 block''' | ||
+ | |||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"> | ||
+ | <code>PSHA256Block = ^TSHA256Block;</code> | ||
+ | |||
+ | <code>TSHA256Block = record</code> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | | <code>Data:Pointer;</code> | ||
+ | | style="width: 50%;"| | ||
+ | |- | ||
+ | | <code>Size:LongWord;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>Next:PSHA256Block;</code> | ||
+ | | | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | |||
+ | '''SHA256 context''' | ||
+ | |||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"> | ||
+ | <code>PSHA256Context = ^TSHA256Context;</code> | ||
+ | |||
+ | <code>TSHA256Context = record</code> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | | <code>Data:array[0..63] of Byte;</code> | ||
+ | | style="width: 50%;"| | ||
+ | |- | ||
+ | | <code>State:array[0..7] of LongWord;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>Count:QWord;</code> | ||
+ | | | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | |||
+ | '''SHA256 byte buffer''' | ||
+ | |||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"> | ||
+ | <code>PSHA256ByteBuffer = ^TSHA256ByteBuffer;</code> | ||
+ | |||
+ | <code>TSHA256ByteBuffer = array[0..63] of Byte;</code> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | | | ||
+ | | style="width: 50%;"| | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | |||
+ | '''SHA256 long buffer''' | ||
+ | |||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"> | ||
+ | <code>PSHA256LongBuffer = ^TSHA256LongBuffer;</code> | ||
+ | |||
+ | <code>TSHA256LongBuffer = array[0..15] of LongWord;</code> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | | | ||
+ | | style="width: 50%;"| | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | |||
+ | '''SHA256 algorithm''' | ||
+ | |||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"> | ||
+ | <code>PSHA256_W = ^TSHA256_W;</code> | ||
+ | |||
+ | <code>TSHA256_W = array[0..63] of LongWord;</code> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | |colspan="2"|Note: This is the W array for the SHA256 algorithm | ||
+ | |- | ||
+ | | | ||
+ | | style="width: 50%;"| | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | |||
+ | '''Hash context''' | ||
+ | |||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"> | ||
+ | <code>PHashContext = ^THashContext;</code> | ||
+ | |||
+ | <code>THashContext = record</code> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | | <code>Algorithm:LongWord;</code> | ||
+ | | style="width: 50%;"| | ||
+ | |- | ||
+ | | <code>Key:array[0..63] of Byte;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>KeySize:LongWord;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>case Integer of</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>0:(MD5:TMD5Context);</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>1:(SHA1:TSHA1Context);</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>2:(SHA256:TSHA256Context);</code> | ||
+ | | | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | |||
+ | '''Cipher context''' | ||
+ | |||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"> | ||
+ | <code>PCipherContext = ^TCipherContext;</code> | ||
+ | |||
+ | <code>TCipherContext = record</code> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | | <code>Algorithm:LongWord;</code> | ||
+ | | style="width: 50%;"| | ||
+ | |- | ||
+ | | <code>case Integer of</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>0:(RC4:TRC4Context);</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>1:(DES:TDESContext);</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>2:(DES3:TDES3Context);</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>3:(AES:TAESContext);</code> | ||
+ | | | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
=== Public variables === | === Public variables === |
Revision as of 05:12, 30 March 2018
Return to Unit Reference
Contents
[hide]Description
Ultibo Crypto interface unit
To be documented
Constants
CRYPTO_CIPHER_ALG_*
CRYPTO_CIPHER_MODE_*
CRYPTO_HASH_ALG_*
AES_BLOCK_*
AES_KEY_*
DES_BLOCK_*
DES_KEY_*
DES_KEYTYPE_*
DES3_BLOCK_*
DES3_KEY_*
SHA1_*
MIME64_*
Type definitions
MD5 digest
MD5 block
MD5 context
MD5 byte buffer
MD5 long buffer
AES key
AES context
DES key
DES context
3DES key
3DES context
RC4 state
RC4 context
SHA1 digest
SHA1 block
SHA1 context
SHA1 byte buffer
SHA1 long buffer
SHA256 digest
SHA256 block
SHA256 context
SHA256 byte buffer
SHA256 long buffer
SHA256 algorithm
Hash context
Cipher context
Public variables
Crypto specific variables
CryptoInitialized:Boolean;
|
MIME64 variables
MIME64DecodingTable:String;
|
Function declarations
Initialization functions
Crypto functions
function HashCreate(Algorithm:LongWord; Key:Pointer; KeySize:LongWord):PHashContext;
function HashDestroy(Context:PHashContext):Boolean;
function HashUpdate(Context:PHashContext; Data:Pointer; Size:LongWord):Boolean;
function HashFinish(Context:PHashContext; Digest:Pointer; Size:LongWord):Boolean;
function CipherCreate(Algorithm:LongWord; Vector,Key:Pointer; KeySize:LongWord):PCipherContext;
function CipherDestroy(Context:PCipherContext):Boolean;
function CipherEncrypt(Context:PCipherContext; Plain,Crypt:Pointer; Size:LongWord):Boolean;
function CipherDecrypt(Context:PCipherContext; Crypt,Plain:Pointer; Size:LongWord):Boolean;
MD5 functions
function MD5DigestData(Data:PMD5Block; Digest:PMD5Digest):Boolean;
function MD5DigestString(const Value:String; Digest:PMD5Digest):Boolean;
function HMACMD5DigestData(const Key:String; Data:PMD5Block; Digest:PMD5Digest):Boolean;
function HMACMD5DigestString(const Key,Value:String; Digest:PMD5Digest):Boolean;
AES functions
function AESEncryptData(Key:Pointer; KeySize:LongWord; Vector,Plain,Crypt:Pointer; Size:LongWord):Boolean;
function AESDecryptData(Key:Pointer; KeySize:LongWord; Vector,Crypt,Plain:Pointer; Size:LongWord):Boolean;
DES functions
function DESEncryptData(Key:Pointer; KeySize:LongWord; Vector,Plain,Crypt:Pointer; Size:LongWord):Boolean;
function DESDecryptData(Key:Pointer; KeySize:LongWord; Vector,Crypt,Plain:Pointer; Size:LongWord):Boolean;
3DES functions
function DES3EncryptData(Key:Pointer; KeySize:LongWord; Vector,Plain,Crypt:Pointer; Size:LongWord):Boolean;
function DES3DecryptData(Key:Pointer; KeySize:LongWord; Vector,Crypt,Plain:Pointer; Size:LongWord):Boolean;
RC4 functions
function RC4EncryptData(Key:Pointer; KeySize:LongWord; Plain,Crypt:Pointer; Size,Start:LongWord):Boolean;
function RC4DecryptData(Key:Pointer; KeySize:LongWord; Crypt,Plain:Pointer; Size,Start:LongWord):Boolean; inline;
SHA1 functions
function SHA1DigestData(Data:PSHA1Block; Digest:PSHA1Digest):Boolean;
function SHA1DigestString(const Value:String; Digest:PSHA1Digest):Boolean;
function HMACSHA1DigestData(const Key:String; Data:PSHA1Block; Digest:PSHA1Digest):Boolean;
function HMACSHA1DigestString(const Key,Value:String; Digest:PSHA1Digest):Boolean;
SHA256 functions
function SHA256DigestData(Data:PSHA256Block; Digest:PSHA256Digest):Boolean;
function SHA256DigestString(const Value:String; Digest:PSHA256Digest):Boolean;
function HMACSHA256DigestData(const Key:String; Data:PSHA256Block; Digest:PSHA256Digest):Boolean;
function HMACSHA256DigestString(const Key,Value:String; Digest:PSHA256Digest):Boolean;
CRC functions
function CRC16CCITT(CRC:Word; Data:PByte; Size:LongWord):Word;
MIME64 functions
Crypto helper functions
procedure BytesToLE(Buffer:PByte; Count:LongWord);
procedure BytesToBE(Buffer:PByte; Count:LongWord);
procedure BEToLongWord(Value:LongWord; Buffer:PByte); inline;
MD5 helper functions
procedure MD5Init(var Context:TMD5Context);
procedure MD5Update(var Context:TMD5Context; Data:Pointer; Size:LongWord);
procedure MD5Final(var Context:TMD5Context; var Digest:TMD5Digest);
procedure MD5Transform(var Context:TMD5Context; Buffer:Pointer);
AES helper functions
function AESKeySetup(Key:Pointer; KeySize:LongWord; AESKey:PAESKey):Boolean;
procedure AESEncryptBlock(Plain,Crypt:Pointer; AESKey:PAESKey);
procedure AESDecryptBlock(Crypt,Plain:Pointer; AESKey:PAESKey);
DES helper functions
procedure DESKey(Key:PByte; KeyType:LongWord; CryptKey:PDESKey);
function DESKeySetup(Key:Pointer; KeySize:LongWord; EncryptKey,DecryptKey:PDESKey):Boolean;
procedure DESEncryptBlock(Plain,Crypt:Pointer; EncryptKey:PDESKey);
procedure DESDecryptBlock(Crypt,Plain:Pointer; DecryptKey:PDESKey);
3DES helper functions
function DES3KeySetup(Key:Pointer; KeySize:LongWord; DES3Key:PDES3Key):Boolean;
procedure DES3EncryptBlock(Plain,Crypt:Pointer; DES3Key:PDES3Key);
procedure DES3DecryptBlock(Crypt,Plain:Pointer; DES3Key:PDES3Key);
SHA1 helper functions
procedure SHA1Init(var Context:TSHA1Context);
procedure SHA1Update(var Context:TSHA1Context; Data:Pointer; Size:LongWord);
procedure SHA1Final(var Context:TSHA1Context; var Digest:TSHA1Digest);
procedure SHA1Transform(var Context:TSHA1Context; Buffer:Pointer);
SHA256 helper functions
procedure SHA256Init(var Context:TSHA256Context);
procedure SHA256Process(var Context:TSHA256Context; Data:Pointer; Size:LongWord);
procedure SHA256Complete(var Context:TSHA256Context; var Digest:TSHA256Digest);
procedure SHA256Compress(var Context:TSHA256Context; Buffer:Pointer);
MIME64 helper functions
Return to Unit Reference