file_hash
This function generates what is known as a hash for a file on disk, using one of several available algorithms.
string file_hash(string filename, int algorithm, bool binary)
Parameters:
filename
The name of the file from which the hash should be generated.
algorithm
A number indicating which hashing algorithm to use (see remarks).
binary
A boolean specifying whether or not the resulting string should be in binary or hex form, true meaning binary.
Return value:
The generated hash on success, or a blank string on failure.
Remarks:
A hash is a fixed size representation of an arbitrary amount of data. What this means in practice is that you can pass a file of any size to this function and you will get a string back which is a sort of identifier of the data in the file, always with the same size. It doesn't matter if the file is 1 kb or 1 gb, the size of the hash will always be the same. The hash will change completely if even one byte of the file is different, making it very useful for tasks such as integrity verification etc.
The available algorithms are:

- 1 - SHA256
- 2 - Sha512

Please note that due to the nature of hashes, some completely different blocks of data will ultimately generate the same hash. This is an inevitable consequence of trying to convert an arbitrary amount of data to a fixed size representation, since a hash is entirely different from data compression. However, the frequency at which duplication occurs depends on what hashing algorithm you use. The 256 bit algorithms are more likely to generate duplicates than their 512 bit counterparts, which are twice as large and thus have more room for variation.
Example:

    // Generate a SHA256 bit hash for a file, as a hex string.

    void main()
    {

    string hash=file_hash("some_file.dat", 1, false);
    if(hash=="")
    {
    alert("Error", "The hash could not be generated.\nError description: " + get_last_error_text);
    exit();
    }
    alert("Hash", hash);
    }