HashFile (file hashing)
ts
function HashFile(hashType: string, fileName: string): string;Computes the hash value of a file and returns it as a string.
| Parameter | Type | Requirement | Explanation |
|---|---|---|---|
hashType | string | required | Hash algorithm: one of md5, sha1, sha128, sha256, sha384, sha512, sha3128, sha3256, sha3384, sha3512 |
fileName | string | required | Fully qualified path to the file to hash |
| Return value | Explanation |
|---|---|
| string | The hash value of the file, or an empty string if the operation fails |
Example
ts
var hash = HashFile('sha256', '/home/user/documents/resume.pdf');
if (hash !== "") {
Log('SHA-256 hash: ' + hash);
} else {
Log('Hashing failed.');
}