注意:字符编码为 UTF-8

Function MD5(const v:String):String;
crypto=(sm3,sha224,sha256,sha384,sah512,sha3_224,sha3_256,sha3_384,sha3_512,sha1,md5)
Function Hash.Hash(const v:String[;c:crypto]):String;
Function Hash.HMac(const v,key:String[;c:crypto]):String;
Function Hash.File(const FileName:String[;c:crypto]):String;
注意:DES密钥key与偏移量iv均为8字节,中文3英文数值1字节,ECB模式无iv参数
mode=(ECB,CBC) padding=(Zero,PKCS7)
Function DES.Encode(const v,key:String[;iv:String[;m:mode[;p:padding]]]):String;
Function DES.Decode(const v,key:String[;iv:String[;m:mode[;p:padding]]]):String;
注意:3DES密钥key为24字节与偏移量iv为8字节,中文3英文数值1字节,ECB模式无iv参数
mode=(ECB,CBC) padding=(Zero,PKCS7)
Function TripleDES.Encode(const v,key:String[;iv:String[;m:mode[;p:padding]]]):String;
Function TripleDES.Decode(const v,key:String[;iv:String[;m:mode[;p:padding]]]):String;
注意:AES密钥key为bit128对应16字节,bit192对应24字节,bit256对应32字节,偏移量iv为16字节,中文3英文数值1字节,ECB模式无iv参数
mode=(ECB,CBC) padding=(Zero,PKCS7) keyBit=(bit128,bit192,bit256)
Function AES.Encode(const v,key:String[;iv:String[;b:keyBit[;m:mode[;p:padding]]]]):String;
Function AES.Decode(const v,key:String[;iv:String[;b:keyBit[;m:mode[;p:padding]]]]):String;
注意:SM4密钥key与偏移量iv均为16字节,中文3英文数值1字节,ECB模式无iv参数
mode=(ECB,CBC) padding=(Zero,PKCS7)
Function SM4.Encode(const v,key:String[;iv:String[;m:mode[;p:padding]]]):String;
Function SM4.Decode(const v,key:String[;iv:String[;m:mode[;p:padding]]]):String;
Function Snowflake(const DatacenterID,WorkerID:Integer):String;

================================================================
MD5('abc测试123');
==>
7054512296009b2fd847e7b4564c4653

Hash.Hash('abc测试123',hMD5);
==>
7054512296009b2fd847e7b4564c4653

Hash.HMac('abc测试123','1234567890abcdefghijklmnopqrstuvwxyz',hMD5);
==>
a05ebf2f031a32bffcd076fa261737ed

Hash.File('/index.html',hMD5);
==>
d1546d731a9f30cc80127d57142a482b

================================================================
Hash.Hash('abc测试123',hSM3);
==>
d2a888df862bdb3752d7ad28b2bfdd72891e4b3f27a7ebb7518d12aee873fd1f

Hash.HMac('abc测试123','1234567890abcdefghijklmnopqrstuvwxyz',hSM3);
==>
17ef794be3ade47276cac9cd5584f2a784e276663b6e0f295767d83dd32b77c1

Hash.File('/index.html',hSM3);
==>
eca0fa136707039b90df56d732cf324f311b5a1c350fc6981b006f630ee781b6

================================================================
Hash.Hash('abc测试123',hSHA224);
==>
3705e26db563200209df2cb80a6cbad9f9ef484c68c0cc0c33b1edb3

Hash.HMac('abc测试123','1234567890abcdefghijklmnopqrstuvwxyz',hSHA224);
==>
ec02c3f8752645e2407c2dfc17601aa8b5eb482aad24ec8595345ac6

Hash.File('/index.html',hSHA224);
==>
d58be356710ae934fa7c14dea147b8f33dfeda712c2eea6a7bf04937

================================================================
Hash.Hash('abc测试123',hSHA256);
==>
c67f7b406c36b6da6844f4a4fded5b5e5b998b4bd5c4fdbf9a1c889a877d90aa

Hash.HMac('abc测试123','1234567890abcdefghijklmnopqrstuvwxyz',hSHA256);
==>
0453e9ee989b22cd5b87a3a988e4ad5d6d88d7db16d7afe3ad8f3fcbfd442a2c

Hash.File('/index.html',hSHA256);
==>
bbba9e2bbdcc236f7b8c98040e1db75ef1e68cd759701723c2e4afda1102ad71

================================================================
Hash.Hash('abc测试123',hSHA384);
==>
d70252d57479ad84983a71aad1a376b294c23dc40870a0de2630f6e4411fceab32d9c91ae227130e73e83fd0e08841e1

Hash.HMac('abc测试123','1234567890abcdefghijklmnopqrstuvwxyz',hSHA384);
==>
caec30b5d2a2c936a2d8373cd325ac479d7a25698e6bd18287ed0410b5a2e9e432dfb20fb316fae6ac0ab6439c8072c8

Hash.File('/index.html',hSHA384);
==>
1ffd9b9c42d1b8ef69963f55c2732e9d27b633a02149af4812439cf0be5b5d469bdcbae786562c136e1800060465a68f

================================================================
Hash.Hash('abc测试123',hSHA512);
==>
2fe13d0a69b978eb85ef862f031a3b3def5c7179e98bbdcfe6f9ad29be6c51dc6ee79bf466de947973d52376d7323848a28d7873cae2f3dbeeaa1fd207dd0245

Hash.HMac('abc测试123','1234567890abcdefghijklmnopqrstuvwxyz',hSHA512);
==>
cc7a28a5b5ecbbf16c42af8f207658dc8f39c58093d070f3600efe753436073c0dbe3d30a92f5a144371fac4fbea8e6fa333287c6dfb465adb9dae0b3f8c6f9e

Hash.File('/index.html',hSHA512);
==>
e5710d55fd9fddcbdec9f27fc57762d267340cabc5e6c37e1320e4211eea7b32396faaab6ae2cd487586585ec8a4b50e0bec675909ad56c4efdb487ad33d4074

================================================================
Hash.Hash('abc测试123',hSHA3_224);
==>
4e800f592cf725ae238e44ccc0ac766766021a28a834f1591a16aa0d

Hash.HMac('abc测试123','1234567890abcdefghijklmnopqrstuvwxyz',hSHA3_224);
==>
d11c53e644d55d1ceddbce696b8db7a5fd6c6486a497f59b75625e56

Hash.File('/index.html',hSHA3_224);
==>
50afd99c909c6a83474a8487c0c6863cd64f953bbf9890c6dcb1349e

================================================================
Hash.Hash('abc测试123',hSHA3_256);
==>
7890805987ca722b2f39ed043a3b63e1ff2d70fd570bb069dbec3fcb5f49af22

Hash.HMac('abc测试123','1234567890abcdefghijklmnopqrstuvwxyz',hSHA3_256);
==>
6577232d1a77b13f9d365860cbe43e7844f24cc1cacf6d7700e51bf962cf4399

Hash.File('/index.html',hSHA3_256);
==>
07c5a1fbcd7133f601edd2bb7bacb59438c052a28fa4a2fcd6ab8deac9acada8

================================================================
Hash.Hash('abc测试123',hSHA3_384);
==>
e33d32373e9b095e0476abba617153b56c08cb2b54a8369c8b7abf35d2c5098c11c4585654fe07e15be17661b78f0993

Hash.HMac('abc测试123','1234567890abcdefghijklmnopqrstuvwxyz',hSHA3_384);
==>
48469b9d7523d3b7833998ac0ed9d376d6ccddbad4f52b2717630493a5147723f01a00f47db01710ef77fab59388aeb9

Hash.File('/index.html',hSHA3_384);
==>
423f2ee879a0c7e4f1c16627f8abdcfe2fe1f2fd9e94a921bf285598d1c4dbc75d461634c1ac86708c5acc3979001335

================================================================
Hash.Hash('abc测试123',hSHA3_512);
==>
4c95e05f80b78370f6fa7e6e12517adcb706e95b275c451d51d7e279f822b15ae637d0a62ec4d657f765db27b9a86c97a797cf396f691e918cac85e35624daf6

Hash.HMac('abc测试123','1234567890abcdefghijklmnopqrstuvwxyz',hSHA3_512);
==>
4908fcb853707a1e3485d6b170ac343713fa371c27a7b5812f4177b78db3c014b3319cccd1c1536c9d58f52496f30ce185a5ed7f71fc90590bec24d02ba0c20e

Hash.File('/index.html',hSHA3_512);
==>
e399e7442eb4d1b96630d6c0144b7f8e3233ead60630f19612613ad5dcc3e4b28f42641b31b451b1d479d3f58e90c22f0d2cc2a92c010a40346e524f0b3aa398

================================================================
Hash.Hash('abc测试123',hSHA1);
==>
05b0f9e281a1704d79ff9cf09d15f5758d66c9e3

Hash.HMac('abc测试123','1234567890abcdefghijklmnopqrstuvwxyz',hSHA1);
==>
729109551f060ea4ac4b3d349fb59b8e53327ee9

Hash.File('/index.html',hSHA1);
==>
0219143d6a1294db10f119cf50d5e6ac326fe422

================================================================
DES.Encode('abc测试123','12345678'); // mode,pad默认可忽略
==>
4dedf3a7979d0450e94f7e9800b0021d

DES.Encode('abc测试123','12345678',ECB,PKCS7);
==>
4dedf3a7979d0450de0e4e68ccdeb31f

DES.Decode('4dedf3a7979d0450e94f7e9800b0021d','12345678'); // mode,pad默认可忽略
==>
abc测试123

DES.Decode('4dedf3a7979d0450de0e4e68ccdeb31f','12345678',ECB,PKCS7);
==>
abc测试123

DES.Encode('abc测试123','12345678','12345678',CBC); // pad默认可忽略
==>
7459de5de7d544a0cc28a365a8f0198a

DES.Encode('abc测试123','12345678','12345678',CBC,PKCS7);
==>
7459de5de7d544a009573d4f500c33ff

DES.Decode('7459de5de7d544a0cc28a365a8f0198a','12345678','12345678',CBC); // pad默认可忽略
==>
abc测试123

DES.Decode('7459de5de7d544a009573d4f500c33ff','12345678','12345678',CBC,PKCS7);
==>
abc测试123

================================================================
TripleDES.Encode('abc测试123','1234567890abcdefghijklmn'); // mode,pad默认可忽略
==>
393da0613712d65af4ff508df798ae0d

TripleDES.Encode('abc测试123','1234567890abcdefghijklmn',ECB,PKCS7);
==>
393da0613712d65ae148b723cda12871

TripleDES.Decode('393da0613712d65af4ff508df798ae0d','1234567890abcdefghijklmn'); // mode,pad默认可忽略
==>
abc测试123

TripleDES.Decode('393da0613712d65ae148b723cda12871','1234567890abcdefghijklmn',ECB,PKCS7);
==>
abc测试123

TripleDES.Encode('abc测试123','1234567890abcdefghijklmn','12345678',CBC); // pad默认可忽略
==>
ab37729e8baf48725127204100097bbc

TripleDES.Encode('abc测试123','1234567890abcdefghijklmn','12345678',CBC,PKCS7);
==>
ab37729e8baf48720b781fde1405d868

TripleDES.Decode('ab37729e8baf48725127204100097bbc','1234567890abcdefghijklmn','12345678',CBC); // pad默认可忽略
==>
abc测试123

TripleDES.Decode('ab37729e8baf48720b781fde1405d868','1234567890abcdefghijklmn','12345678',CBC,PKCS7);
==>
abc测试123

================================================================
AES.Encode('abc测试123','1234567890abcdef'); // keyBit,mode,pad默认可忽略
==>
15bcff20bca6b87646928efebfb73191

AES.Encode('abc测试123','1234567890abcdef',bit128,ECB,PKCS7);
==>
648c43fa7ed9e9aba3828c71819e4c35

AES.Decode('15bcff20bca6b87646928efebfb73191','1234567890abcdef','1234567890abcdef'); // keyBit,mode,pad默认可忽略
==>
abc测试123

AES.Decode('648c43fa7ed9e9aba3828c71819e4c35','1234567890abcdef','1234567890abcdef',bit128,ECB,PKCS7);
==>
abc测试123

AES.Encode('abc测试123','1234567890abcdef','1234567890abcdef',bit128,CBC); // pad默认可忽略
==>
0cf55aaa7c0ce6ef7c86e9666fbccc59

AES.Encode('abc测试123','1234567890abcdef','1234567890abcdef',bit128,CBC,PKCS7);
==>
03d601a67710cdc3bf0c094605c86374

AES.Decode('0cf55aaa7c0ce6ef7c86e9666fbccc59','1234567890abcdef','1234567890abcdef',bit128,CBC); // pad默认可忽略
==>
abc测试123

AES.Decode('03d601a67710cdc3bf0c094605c86374','1234567890abcdef','1234567890abcdef',bit128,CBC,PKCS7);
==>
abc测试123

================================================================
SM4.Encode('abc测试123','1234567890abcdef'); // mode,pad默认可忽略
==>
c63444f286ae6bdb10d02bb9136efdd5

SM4.Encode('abc测试123','1234567890abcdef',ECB,PKCS7);
==>
7483f6c6cd47947cc7dea4fdf3d8e660

SM4.Decode('c63444f286ae6bdb10d02bb9136efdd5','1234567890abcdef'); // mode,pad默认可忽略
==>
abc测试123

SM4.Decode('7483f6c6cd47947cc7dea4fdf3d8e660','1234567890abcdef',ECB,PKCS7);
==>
abc测试123

SM4.Encode('abc测试123','1234567890abcdef','1234567890abcdef',CBC); // pad默认可忽略
==>
27314649852a9482fb08a8fa8dd0691d

SM4.Encode('abc测试123','1234567890abcdef','1234567890abcdef',CBC,PKCS7);
==>
97ea763567e61b7b429297a29b4970eb

SM4.Decode('27314649852a9482fb08a8fa8dd0691d','1234567890abcdef','1234567890abcdef',CBC); // pad默认可忽略
==>
abc测试123

SM4.Decode('97ea763567e61b7b429297a29b4970eb','1234567890abcdef','1234567890abcdef',CBC,PKCS7);
==>
abc测试123

================================================================
Snowflake(0,0); 或 Snowflake();
==>
790187335378534400