Function Char2Hash() Foundation
Convert a character string to a hash value
Char2Hash( <cString> [, <nBitLen>] ) --> cHash
The hash value of the parameter <cString>. cHash is a character string representing a hexadecimal number.
The Char2Hash() function implements a cryptographic hash function. A cryptographic hash function is a special class of hash function which makes it suitable for use in cryptography. It is an algorithm that maps data of arbitrary size to a bit string of a fixed size (the hash value), and is designed to be a one-way function. The only way to recreate the input data from a cryptographic hash function's output is to attempt a brute-force search of possible inputs to see if they produce a match.
Hash algorithms are designed to have a low collision rate. This means that two similar input parameters produce two completely different results:
Depending on the optional parameter <nBitLen>, Char2Hash() selects a hash algorithm according to the following table. The length of the return value cHash depends on the selected algorithm.
Algorithm | nBitLen | Length of cHash |
---|---|---|
MD5 | 128 | 32 |
SHA1 | 160 | 40 |
SHA2-256 | 256 | 64 |
SHA3-512 | 512 | 128 |
Note that the bit length of the resulting hash value implicitly indicates the level of security. A greater bit length implies a higher effort required in a brute-force attack.
If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.