"Sputnik" help  
Sputnik Help
HashFile(<algo>, <file>, [<rawOutput>])

Description

Generates a hash value for the contents of a specified file using the specified algorithm.

Parameters

<algo> The hash algorithm to use (e.g., "md5", "sha256").
<file> The path to the file for which the hash is generated.
[<rawOutput>] Optional. If set to true, returns a binary hash; otherwise, returns a string hash. Default is a string hash.

Return Value

Success: Returns the hash value as either a string or binary, based on the rawOutput parameter.
Failure: Returns an empty string or binary, based on the rawOutput parameter.

Remarks

The HashFile function is commonly used to generate hash values for file integrity verification or unique identification. The algorithm parameter should be selected based on security and performance requirements.

See HashAlgos and Hash for a list of hashes.

Related

Example

Example of usage:

say HashFile("md5", "Sputnik.exe");
say HashFile("gost", "Sputnik.exe");
// PRINTS
// 7E7C2C29E03128B6D852FF067EE3F146
// 970F56285E0F96C55596711BC7B6F66DE64C96751A951B29B2BD88E207A11A00

In this example we calculate and display two hash values for the "Sputnik.exe" executable file. The first hash is computed using the MD5 algorithm, resulting in the value "7E7C2C29E03128B6D852FF067EE3F146." The second hash is calculated using the GOST algorithm, producing the value "970F56285E0F96C55596711BC7B6F66DE64C96751A951B29B2BD88E207A11A00." These hash values serve as unique fingerprints for the file content, providing a means for file integrity verification or identification based on distinct cryptographic representations.


Contact
Cheryl (uberfox@hotmail.com)
Homepage
http://ubersoft.org