msgdigest
msgdigest |
Purpose
Synopsis
function msgdigest(mdalg:string, fname:string, mdf:string):integer
function msgdigest(fname:string, mdf:string):integer
Arguments
mdalg
|
Name of the algorithm to use
|
fname
|
Name of the file to be processed
|
mdf
|
File where to store the digest
|
Return value
Size of the message digest in bytes or
-1 if case of error.
Example
The following procedure implements the command 'md5sum':
procedure md5sum(f:string) if msgdigest("md5",f,"mem:dgst")<>16 then writeln("Failed to compute digest") else fcopy("mem:dgst",F_BINARY,"hex:",F_TEXT) writeln(" ",f) end-if end-procedure
Further information
1. This function computes a message digest (MD) using either the algorithm specified by the
mdalg argument or the default algorithm as defined by the control parameter
ssl_digest. The produced output takes the form of a binary file the size of which is returned by the function.
2. The set of supported algorithms includes
"md5",
"sha", and
"sha256". For a full list use the command
mmssl list digest.
Related topics
Module