|
@@ -4,7 +4,7 @@
|
|
General Hash Unit: This unit defines the common types, functions,
|
|
General Hash Unit: This unit defines the common types, functions,
|
|
and procedures
|
|
and procedures
|
|
|
|
|
|
- Copyright (C) 2009-2019 Alexander Koblov ([email protected])
|
|
|
|
|
|
+ Copyright (C) 2009-2021 Alexander Koblov ([email protected])
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
This program is free software; you can redistribute it and/or modify
|
|
it under the terms of the GNU General Public License as published by
|
|
it under the terms of the GNU General Public License as published by
|
|
@@ -33,7 +33,7 @@ uses
|
|
type
|
|
type
|
|
THashContext = TDCP_hash;
|
|
THashContext = TDCP_hash;
|
|
THashAlgorithm = (HASH_BLAKE2S, HASH_BLAKE2SP, HASH_BLAKE2B, HASH_BLAKE2BP, HASH_BLAKE3,
|
|
THashAlgorithm = (HASH_BLAKE2S, HASH_BLAKE2SP, HASH_BLAKE2B, HASH_BLAKE2BP, HASH_BLAKE3,
|
|
- HASH_CRC32, HASH_HAVAL, HASH_MD4, HASH_MD5, HASH_RIPEMD128, HASH_RIPEMD160,
|
|
|
|
|
|
+ HASH_CHECKSUM32, HASH_CRC32, HASH_HAVAL, HASH_MD4, HASH_MD5, HASH_RIPEMD128, HASH_RIPEMD160,
|
|
HASH_SFV, HASH_SHA1, HASH_SHA224, HASH_SHA256, HASH_SHA384, HASH_SHA512,
|
|
HASH_SFV, HASH_SHA1, HASH_SHA224, HASH_SHA256, HASH_SHA384, HASH_SHA512,
|
|
HASH_SHA3_224, HASH_SHA3_256, HASH_SHA3_384, HASH_SHA3_512, HASH_TIGER,
|
|
HASH_SHA3_224, HASH_SHA3_256, HASH_SHA3_384, HASH_SHA3_512, HASH_TIGER,
|
|
HASH_BEST
|
|
HASH_BEST
|
|
@@ -41,14 +41,14 @@ type
|
|
|
|
|
|
var
|
|
var
|
|
HashFileExt: array[Low(THashAlgorithm)..Pred(High(THashAlgorithm))] of String = (
|
|
HashFileExt: array[Low(THashAlgorithm)..Pred(High(THashAlgorithm))] of String = (
|
|
- 'blake2s', 'blake2sp', 'blake2b', 'blake2bp', 'blake3', 'crc32', 'haval',
|
|
|
|
|
|
+ 'blake2s', 'blake2sp', 'blake2b', 'blake2bp', 'blake3', 'checksum32', 'crc32', 'haval',
|
|
'md4', 'md5', 'ripemd128', 'ripemd160', 'sfv', 'sha', 'sha224', 'sha256',
|
|
'md4', 'md5', 'ripemd128', 'ripemd160', 'sfv', 'sha', 'sha224', 'sha256',
|
|
'sha384', 'sha512', 'sha3', 'sha3', 'sha3', 'sha3', 'tiger'
|
|
'sha384', 'sha512', 'sha3', 'sha3', 'sha3', 'sha3', 'tiger'
|
|
);
|
|
);
|
|
|
|
|
|
var
|
|
var
|
|
HashName: array[Low(THashAlgorithm)..Pred(High(THashAlgorithm))] of String = (
|
|
HashName: array[Low(THashAlgorithm)..Pred(High(THashAlgorithm))] of String = (
|
|
- 'blake2s', 'blake2sp', 'blake2b', 'blake2bp', 'blake3', 'crc32', 'haval',
|
|
|
|
|
|
+ 'blake2s', 'blake2sp', 'blake2b', 'blake2bp', 'blake3', 'checksum32', 'crc32', 'haval',
|
|
'md4', 'md5', 'ripemd128', 'ripemd160', 'sfv', 'sha1_160', 'sha2_224',
|
|
'md4', 'md5', 'ripemd128', 'ripemd160', 'sfv', 'sha1_160', 'sha2_224',
|
|
'sha2_256', 'sha2_384', 'sha2_512', 'sha3_224', 'sha3_256',
|
|
'sha2_256', 'sha2_384', 'sha2_512', 'sha3_224', 'sha3_256',
|
|
'sha3_384', 'sha3_512', 'tiger'
|
|
'sha3_384', 'sha3_512', 'tiger'
|
|
@@ -67,7 +67,7 @@ function FileExtToHashAlg(const FileExt: String): THashAlgorithm;
|
|
implementation
|
|
implementation
|
|
|
|
|
|
uses
|
|
uses
|
|
- LazUTF8, DCPhaval, DCPmd4, DCPmd5, DCPripemd128, DCPripemd160, DCPcrc32,
|
|
|
|
|
|
+ LazUTF8, DCPhaval, DCPmd4, DCPmd5, DCPripemd128, DCPripemd160, DCPChecksum32, DCPcrc32,
|
|
DCPsha1, DCPsha256, DCPsha512, DCPtiger, DCPblake2, DCPblake3, DCPsha3;
|
|
DCPsha1, DCPsha256, DCPsha512, DCPtiger, DCPblake2, DCPblake3, DCPsha3;
|
|
|
|
|
|
procedure HashInit(out Context: THashContext; Algorithm: THashAlgorithm);
|
|
procedure HashInit(out Context: THashContext; Algorithm: THashAlgorithm);
|
|
@@ -87,6 +87,7 @@ begin
|
|
HASH_BLAKE2B: Context:= TDCP_blake2b.Create(nil);
|
|
HASH_BLAKE2B: Context:= TDCP_blake2b.Create(nil);
|
|
HASH_BLAKE2BP: Context:= TDCP_blake2bp.Create(nil);
|
|
HASH_BLAKE2BP: Context:= TDCP_blake2bp.Create(nil);
|
|
HASH_BLAKE3: Context:= TDCP_blake3.Create(nil);
|
|
HASH_BLAKE3: Context:= TDCP_blake3.Create(nil);
|
|
|
|
+ HASH_CHECKSUM32: Context:= TDCP_checksum32.Create(nil);
|
|
HASH_CRC32: Context:= TDCP_crc32.Create(nil);
|
|
HASH_CRC32: Context:= TDCP_crc32.Create(nil);
|
|
HASH_HAVAL: Context:= TDCP_haval.Create(nil);
|
|
HASH_HAVAL: Context:= TDCP_haval.Create(nil);
|
|
HASH_MD4: Context:= TDCP_md4.Create(nil);
|
|
HASH_MD4: Context:= TDCP_md4.Create(nil);
|
|
@@ -105,6 +106,7 @@ begin
|
|
HASH_SHA3_512: Context:= TDCP_sha3_512.Create(nil);
|
|
HASH_SHA3_512: Context:= TDCP_sha3_512.Create(nil);
|
|
HASH_TIGER: Context:= TDCP_tiger.Create(nil);
|
|
HASH_TIGER: Context:= TDCP_tiger.Create(nil);
|
|
end;
|
|
end;
|
|
|
|
+
|
|
Context.Init;
|
|
Context.Init;
|
|
end;
|
|
end;
|
|
|
|
|