|
|
|
|
- Notes
- Availability of algorithms
HashFile (Function) In french: HashFichier Calculates the Hash of a file according to a specific algorithm. You can calculate: - a simple hash.
- a hash with message authentication.
- a hash obtained with a key derivation function that takes a salt as parameter (PBKDF2).
Not available.
Reminder: Hashing is used to summarize a file or a character string. This summary is called Hash. Caution: The result may contain non-displayable characters. If you want to get a string with the hexadecimal representations of bytes (to use it in a REST or SOAP API, for example) you can use BufferToHexa with the NoGrouping constant on the result buffer.
Syntax
Calculating a simple hash Hide the details
<Result> = HashFile(<Type of algorithm> , <File path> [, <Progress Bar>])
<Result>: Buffer Result of <File path> hashing with the <Type of algorithm> algorithm. <Type of algorithm>: Integer constant Indicates the type of algorithm used when hashing the <File path> file:
| | MD4 family | HA_MD4
| MD5 family | HA_MD5_128 Caution: this type of algorithm is currently deprecated. | MURMUR family | - HA_MURMUR_1: Murmur algorithm version 1: 32-bit hash result
- HA_MURMUR_2: Murmur algorithm version 2: 32-bit hash result
- HA_MURMUR_2_64A: Murmur algorithm version 2: 64-bit hash result optimized for 64-bit processors
- HA_MURMUR_2_64B: Murmur algorithm version 2: 64-bit hash result optimized for 32-bit processors
- HA_MURMUR_2_A: Incremental Murmur algorithm version 2: 32-bit hash result
- HA_MURMUR_2_BIG_ENDIAN: Murmur algorithm version 2 for big-endian machine: 32-bit hash result
- HA_MURMUR_2_ALIGNE: Murmur algorithm version 2 for aligned machine: 32-bit hash result
- HA_MURMUR_3_32: Murmur algorithm version 3: 32-bit hash result
- HA_MURMUR_3_128_X86: Murmur algorithm version 3: 128-bit hash result optimized for 32-bit processors
- HA_MURMUR_3_128_X64: Murmur algorithm version 3: 128-bit hash result optimized for 64-bit processors
| RIPEMD family | - HA_RIPEMD_128
- HA_RIPEMD_160
| SHA family | - HA_SHA_160 (also called SHA-1)
- HA_SHA_256 (FIPS PUB 198 specifications)
- HA_SHA_256_DOUBLE
- HA_SHA_384
- HA_SHA_512
| SHA-3 family | - HA_SHA3_224
- HA_SHA3_256
- HA_SHA3_384
- HA_SHA3_512
| TIGER family | - HA_TIGER_128
- HA_TIGER_160
- HA_TIGER_192
| WHIRLPOOL family | HA_WHIRLPOOL | CKSUM family | - HA_CKSUM_8
- HA_CKSUM_16
- HA_CKSUM_32
- HA_CKSUM_64
|
- MD4 / MD5 / SHA / RIPEMD algorithms: standard cryptographic hash functions.
- TIGER/WHIRLPOOL algorithms: hash functions with high cryptographic properties optimized for the 64-bit mode (but can also be used in 32-bit mode).
- CKSUM algorithms: hash functions with no cryptographic property, should be used to perform low-level checks or with hashing tables.
- MURMUR algorithm: very fast hash functions with no cryptographic properties. This algorithm is used by the "bloom filter" of bitcoin wallets.
<File path>: Character string Path of file on which the calculation will be performed. <Progress Bar>: Optional window name or optional control name
Calculating a hash with message authentication (HMAC/MURMUR algorithm) Hide the details
<Result> = HashFile(<Type of algorithm> , <File path> , <Secret key> [, <Progress Bar>])
<Result>: Buffer Result of <File path> hashing with the <Type of algorithm> algorithm.Caution: This result may contain non-displayable characters. <Type of algorithm>: Integer constant Indicates the type of HMAC algorithm used when hashing the <File path> file:
| | MD4 family | HA_HMAC_MD4
| MD5 family | HA_HMAC_MD5_128 Caution: this type of algorithm is currently deprecated. | MURMUR family | - HA_MURMUR_1: Murmur algorithm version 1: 32-bit hash result
- HA_MURMUR_2: Murmur algorithm version 2: 32-bit hash result
- HA_MURMUR_2_64A: Murmur algorithm version 2: 64-bit hash result optimized for 64-bit processors
- HA_MURMUR_2_64B: Murmur algorithm version 2: 64-bit hash result optimized for 32-bit processors
- HA_MURMUR_2_A: Incremental Murmur algorithm version 2: 32-bit hash result
- HA_MURMUR_2_BIG_ENDIAN: Murmur algorithm version 2 for big-endian machine: 32-bit hash result
- HA_MURMUR_2_ALIGNE: Murmur algorithm version 2 for aligned machine: 32-bit hash result
- HA_MURMUR_3_32: Murmur algorithm version 3: 32-bit hash result
- HA_MURMUR_3_128_X86: Murmur algorithm version 3: 128-bit hash result optimized for 32-bit processors
- HA_MURMUR_3_128_X64: Murmur algorithm version 3: 128-bit hash result optimized for 64-bit processors
| RIPEMD family | - HA_HMAC_RIPEMD_128
- HA_HMAC_RIPEMD_160
| SHA family | - HA_HMAC_SHA_160
- HA_HMAC_SHA_256
- HA_HMAC_SHA_256_DOUBLE
- HA_HMAC_SHA_384
- HA_HMAC_SHA_512
| SHA-3 family | - HA_HMAC_SHA3_224
- HA_HMAC_SHA3_256
- HA_HMAC_SHA3_384
- HA_HMAC_SHA3_512
| TIGER family | - HA_HMAC_TIGER_128
- HA_HMAC_TIGER_160
- HA_HMAC_TIGER_192
| WHIRLPOOL family | HA_HMAC_WHIRLPOOL |
- MD4 / MD5 / SHA / RIPEMD algorithms: standard cryptographic hash functions.
- TIGER/WHIRLPOOL algorithms: hash functions with high cryptographic properties optimized for the 64-bit mode (but can also be used in 32-bit mode).
- MURMUR algorithm: very fast hash functions with no cryptographic properties. This algorithm is used by the "bloom filter" of bitcoin wallets.
<File path>: Character string Path of file on which the calculation will be performed. <Secret key>: Character string or Integer Authentication key of message. - If an HMAC algorithm is used, this parameter must be a string.
- If a MURMUR algorithm is used, the key must be an integer.
<Progress Bar>: Optional control name or optional window name
Remarks Notes - Two files with an identical content will have, for the same type of algorithm, two identical Hashes.
- The result of the Hash may contain non-displayable characters. These characters will not be visible when using Info or Trace for example.
Related Examples:
|
Unit examples (WINDEV): The Hash functions
[ + ] Using the hashing functions. The HashFile and HashString functions are used to calculate a Hash key for a string or for a file. This Hash key is used to: - Check whether the file is consistent after a transfer for example - Find file duplicates - ...
|
Business / UI classification: Business Logic
This page is also available for…
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|