Topics   All   Mac OS X (Only)   Windows (Only)   Linux (Only, Not)   iOS (Only, Not)  
Components   Crossplatform Mac & Win   Server   Client   Old   Guides   Examples
New in version: 7.5   8.0   8.1   8.2   8.3   8.4   8.5   9.0   9.1   9.2    Statistic  

Hash.DigestFile

Calculates a hash of a file.

Component Version macOS Windows Server FileMaker Cloud FileMaker iOS SDK
Hash 9.2 Yes Yes Yes Yes Yes
MBS( "Hash.DigestFile"; Algorithm; FilePath; OutputType { ; OutputInfo } )   More

Parameters

Parameter Description Example value
Algorithm Which algorithm to use.
Can be MD4, MD5, SHA, SHA1, MDC2, RIPEMD160, SHA224, SHA256, SHA384 or SHA512.
"SHA512"
FilePath The native file path to use. "C:\test.dat"
OutputType The output type.
Can be Base64, Hex, Text, File, Path.
"Hex"
OutputInfo Optional
The addition info for output.
For text it is the text encoding, for file container the file name and for path the actual native file path.
""

Result

Returns OK or error.

Description

Calculates a hash of a file.
This function is optimized to process files on disk in chunks, so it works well for several GB of file sizes.

For output we can return the digest in various ways:
  • Base64, the hash is returned as base64 encoded text.
  • Hex, the hash is returned as hex encoded text.

Possible digest engines:
DSA-SHA, DSA, MD5, MDC2, RIPEMD160, SHA, SHA1, SHA224, SHA256, SHA384 or SHA512.

This function requires a native path. Use Path.FileMakerPathToNativePath to convert a FileMaker path to a native path if required. If you like to have the user choose the path, you can use FileDialog functions.
For Server be aware that server has limited permissions and may not be able to access all files on a computer.

Examples

Create MD5 of file:

MBS("Hash.DigestFile"; "MD5"; "/Users/cs/Movies/test.mov"; "hex")

See also

Blog Entries

Created 12nd April 2019, last changed 12nd April 2019


Hash.Digest   -   Hash.MD5

Feedback: Report problem or ask question.




Links
MBS Xojo blog