Difference between revisions of "Unit Crypto"

From Ultibo.org
Jump to: navigation, search
Line 12: Line 12:
 
----
 
----
  
''To be documented''
+
 
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''Crypto cipher algorithms''' <code> CRYPTO_CIPHER_ALG_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>CRYPTO_CIPHER_ALG_NONE = 0;</code>
 +
| style="width: 50%;"|&nbsp;
 +
|-
 +
| <code>CRYPTO_CIPHER_ALG_AES = 1;</code>
 +
| &nbsp;
 +
|-
 +
| <code>CRYPTO_CIPHER_ALG_DES = 2;</code>
 +
| &nbsp;
 +
|-
 +
| <code>CRYPTO_CIPHER_ALG_3DES = 3;</code>
 +
| &nbsp;
 +
|-
 +
| <code>CRYPTO_CIPHER_ALG_RC4 = 4;</code>
 +
| &nbsp;
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''Crypto cipher modes''' <code> CRYPTO_CIPHER_MODE_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>CRYPTO_CIPHER_MODE_ECB = 0;</code>
 +
| Electronic Codebook
 +
|-
 +
| <code>CRYPTO_CIPHER_MODE_CBC = 1;</code>
 +
| Cipher Block Chaining
 +
|-
 +
| <code>CRYPTO_CIPHER_MODE_CFB = 2;</code>
 +
| Cipher Feedback
 +
|-
 +
| <code>CRYPTO_CIPHER_MODE_OFB = 3;</code>
 +
| Output Feedback
 +
|-
 +
| <code>CRYPTO_CIPHER_MODE_CRT = 4;</code>
 +
| Counter
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''Crypto hash algorithms''' <code> CRYPTO_HASH_ALG_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>CRYPTO_HASH_ALG_NONE = 0;</code>
 +
| style="width: 50%;"|&nbsp;
 +
|-
 +
| <code>CRYPTO_HASH_ALG_MD5 = 1;</code>
 +
| &nbsp;
 +
|-
 +
| <code>CRYPTO_HASH_ALG_SHA1 = 2;</code>
 +
| &nbsp;
 +
|-
 +
| <code>CRYPTO_HASH_ALG_SHA256 = 3;</code>
 +
| &nbsp;
 +
|-
 +
| <code>CRYPTO_HASH_ALG_HMAC_MD5 = 4;</code>
 +
| &nbsp;
 +
|-
 +
| <code>CRYPTO_HASH_ALG_HMAC_SHA1 = 5;</code>
 +
| &nbsp;
 +
|-
 +
| <code>CRYPTO_HASH_ALG_HMAC_SHA256 = 6;</code>
 +
| &nbsp;
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''AES block size''' <code> AES_BLOCK_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>AES_BLOCK_SIZE = 16;</code>
 +
| 128 bit blocks
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''AES key size''' <code> AES_KEY_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>AES_KEY_SIZE128 = 16;</code>
 +
| 128 bit keys
 +
|-
 +
| <code>AES_KEY_SIZE192 = 24;</code>
 +
| 192 bit keys
 +
|-
 +
| <code>AES_KEY_SIZE256 = 32;</code>
 +
| 256 bit keys
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''DES block size''' <code> DES_BLOCK_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>DES_BLOCK_SIZE = 8;</code>
 +
| 64 bit blocks
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''DES key size ''' <code> DES_KEY_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>DES_KEY_SIZE = 8;</code>
 +
| 64 bit keys
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''DES key type''' <code> DES_KEYTYPE_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>DES_KEYTYPE_ENCRYPT = 0;</code>
 +
| style="width: 50%;"|&nbsp;
 +
|-
 +
| <code>DES_KEYTYPE_DECRYPT = 1;</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
|colspan="2"|<code>DES_BYTEBIT:array[0..7] of LongWord = (</code>
 +
|-
 +
| <code>$80, $40, $20, $10, $08, $04, $02, $01);</code>
 +
| &nbsp;
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''3DES block size''' <code> DES3_BLOCK_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>DES3_BLOCK_SIZE = 8;</code>
 +
| 64 bit blocks
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''3DES key size''' <code> DES3_KEY_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>DES3_KEY_SIZE = 24;</code>
 +
| 192 bit (3 x 64 bit) keys
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''SHA1 constants''' <code> SHA1_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>SHA1_K20 = $5A827999;</code>
 +
| style="width: 50%;"|&nbsp;
 +
|-
 +
| <code>SHA1_K40 = $6ED9EBA1;</code>
 +
| &nbsp;
 +
|-
 +
| <code>SHA1_K60 = $8F1BBCDC;</code>
 +
| &nbsp;
 +
|-
 +
| <code>SHA1_K80 = $CA62C1D6;</code>
 +
| &nbsp;
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''MIME64 constants''' <code> MIME64_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>MIME64EncodingTable:String = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';</code>
 +
| style="width: 50%;"|&nbsp;
 +
|-
 +
|}
 +
</div></div>
 +
<br />
  
 
=== Type definitions ===
 
=== Type definitions ===

Revision as of 03:05, 30 March 2018

Return to Unit Reference


Description


Ultibo Crypto interface unit

To be documented

Constants



Crypto cipher algorithms CRYPTO_CIPHER_ALG_*
CRYPTO_CIPHER_ALG_NONE = 0;  
CRYPTO_CIPHER_ALG_AES = 1;  
CRYPTO_CIPHER_ALG_DES = 2;  
CRYPTO_CIPHER_ALG_3DES = 3;  
CRYPTO_CIPHER_ALG_RC4 = 4;  


Crypto cipher modes CRYPTO_CIPHER_MODE_*
CRYPTO_CIPHER_MODE_ECB = 0; Electronic Codebook
CRYPTO_CIPHER_MODE_CBC = 1; Cipher Block Chaining
CRYPTO_CIPHER_MODE_CFB = 2; Cipher Feedback
CRYPTO_CIPHER_MODE_OFB = 3; Output Feedback
CRYPTO_CIPHER_MODE_CRT = 4; Counter


Crypto hash algorithms CRYPTO_HASH_ALG_*
CRYPTO_HASH_ALG_NONE = 0;  
CRYPTO_HASH_ALG_MD5 = 1;  
CRYPTO_HASH_ALG_SHA1 = 2;  
CRYPTO_HASH_ALG_SHA256 = 3;  
CRYPTO_HASH_ALG_HMAC_MD5 = 4;  
CRYPTO_HASH_ALG_HMAC_SHA1 = 5;  
CRYPTO_HASH_ALG_HMAC_SHA256 = 6;  


AES block size AES_BLOCK_*
AES_BLOCK_SIZE = 16; 128 bit blocks


AES key size AES_KEY_*
AES_KEY_SIZE128 = 16; 128 bit keys
AES_KEY_SIZE192 = 24; 192 bit keys
AES_KEY_SIZE256 = 32; 256 bit keys


DES block size DES_BLOCK_*
DES_BLOCK_SIZE = 8; 64 bit blocks


DES key size DES_KEY_*
DES_KEY_SIZE = 8; 64 bit keys


DES key type DES_KEYTYPE_*
DES_KEYTYPE_ENCRYPT = 0;  
DES_KEYTYPE_DECRYPT = 1;  
 
DES_BYTEBIT:array[0..7] of LongWord = (
$80, $40, $20, $10, $08, $04, $02, $01);  


3DES block size DES3_BLOCK_*
DES3_BLOCK_SIZE = 8; 64 bit blocks


3DES key size DES3_KEY_*
DES3_KEY_SIZE = 24; 192 bit (3 x 64 bit) keys


SHA1 constants SHA1_*
SHA1_K20 = $5A827999;  
SHA1_K40 = $6ED9EBA1;  
SHA1_K60 = $8F1BBCDC;  
SHA1_K80 = $CA62C1D6;  


MIME64 constants MIME64_*
MIME64EncodingTable:String = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';  


Type definitions


To be documented

Public variables


To be documented

Function declarations


To be documented


Return to Unit Reference