ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / WLanguage functions / Standard functions / Hash functions
  • Availability of algorithms
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
HashCheckFile (Function)
In french: HashVérifieFichier
Checks the Hash of a file for a specific type of algorithm. You have the ability to check:
  • a simple hash.
  • a hash with message authentication.
  • a hash obtained with a key derivation function that takes a salt as parameter (PBKDF2).
    PHP Not available.
Reminder: Hashing is used to summarize a file or a character string. This summary is called Hash.
Example
WEBDEV - Server codeAjax
// Calculate the Hash of the "C:\Temp\File.txt" file
HashMyFile is string
HashMyFile = HashFile(HA_MD5_128, "C:\Temp\File.txt")
 
// Process on the file
// ...
 
// Checks whether the file was modified
IF HashCheckFile(HA_MD5_128, "C:\Temp\File.txt", ...
HashMyFile) = False THEN
Info("The file was modified.")
END
Syntax

Checking a simple hash Hide the details

<Result> = HashCheckFile(<Type of algorithm> , <File path> , <Hash>)
<Result>: Boolean
  • True if the result when <File path> was hashed by <Type of algorithm> corresponds to <Hash>,
  • False otherwise.
<Type of algorithm>: Integer constant
Indicates the type of algorithm used when hashing the <File path> file:
MD4 familyHA_MD4

MD5 familyHA_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 familyHA_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 for which the Hash will be checked.
<Hash>: Character string
Hash of file to check. This Hash must be the result of HashFile previously called for <File path> using the <Type of algorithm>.

Checking a hash with message authentication (HMAC/MURMUR algorithm) Hide the details

<Result> = HashCheckFile(<Type of algorithm> , <File path> , <Hash> , <Secret key>)
<Result>: Boolean
  • True if the result when <File path> was hashed by <Type of algorithm> corresponds to <Hash>,
  • False otherwise.
<Type of algorithm>: Integer constant
Indicates the type of HMAC algorithm used when hashing the <File path> file:
MD4 familyHA_HMAC_MD4

MD5 familyHA_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 familyHA_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 for which the Hash will be checked.
<Hash>: Character string
Hash of file to check. This Hash must be the result of HashFile previously called for <File path> using the <Type of algorithm>.
<Secret key>: Character string or Integer
Authentication key of message. This key must be identical to the one used to calculate the Hash.
WindowsLinux

Checking a hash obtained using a key derivation function that takes a salt as parameter (PBKDF2) Hide the details

<Result> = HashFile(<Type of algorithm> , <File path> , <Hash> , <Salt> , <Iteration> , <Length> [, <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 pseudo-random function used by PBKDF2 to hash the <File path> file:
MD4 familyHA_PBKDF2_HMAC_MD4
MD5 familyHA_PBKDF2_HMAC_MD5_128
Caution: this type of algorithm is currently deprecated.
RIPEMD family
  • HA_PBKDF2_HMAC_RIPEMD_128
  • HA_PBKDF2_HMAC_RIPEMD_160
SHA family
  • HA_PBKDF2_HMAC_SHA_160
  • HA_PBKDF2_HMAC_SHA_256
  • HA_PBKDF2_HMAC_SHA_256_DOUBLE
  • HA_PBKDF2_HMAC_SHA_384
  • HA_PBKDF2_HMAC_SHA_512
SHA-3 family
  • HA_PBKDF2_HMAC_SHA3_224
  • HA_PBKDF2_HMAC_SHA3_256
  • HA_PBKDF2_HMAC_SHA3_384
  • HA_PBKDF2_HMAC_SHA3_512
TIGER family
  • HA_PBKDF2_HMAC_TIGER_128
  • HA_PBKDF2_HMAC_TIGER_160
  • HA_PBKDF2_HMAC_TIGER_192
WHIRLPOOL familyHA_PBKDF2_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).
<File path>: Character string
Path of file for which the Hash will be checked.
<Hash>: Character string
Hash of file to check. This Hash must be the result of HashFile previously called for <File path> using the <Type of algorithm>.
<Salt>: Character string
Cryptographic salt identical to the one used to calculate the Hash.
<Iteration>: Integer
Number of iterations of the algorithm. This parameter must be identical to the one used to calculate the Hash.
<Length>: Integer
Length of the derived key. This parameter must be identical to the one used to calculate the Hash.
<Progress Bar>: Optional window name or optional control name
WEBDEV - Server code
  • Name of window where the progress bar will be displayed,
  • Name of the Progress Bar control to use.
WEBDEV - Server code This parameter is ignored.
Remarks
PHP

Availability of algorithms

PHP Algorithms are available depending on the PHP server configuration ('mhash' extension, PHP 5 with native hash function, etc).
Business / UI classification: Business Logic
Component: wd290com.dll
Minimum version required
  • Version 11
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 09/19/2022

Send a report | Local help