Please enable JavaScript to view this site.

Enter the help project title here

Navigation: Subroutines > MIAMEX

MIAMEX 25: Get file hash total

Scroll Prev Top Next More

Rewritten June 2020

xcall MIAMEX, MX_HASHFILE, path, hash1, hash2, hash3, hash4

MX_HASHFILE returns a hash code for the file specified in the path argument. The hash algorithm is the same as that used by the AMOS DIR/H command, and consists of four integer values.  

path  (String)  [in]

specification of file being hashed. May be in native or AMOS format.

hash1...4 (Num)  [out]

receive the four parts of the hash. Each part if an integer from zero to 255.

Example

The following example illustrates the use of this function to display a hash total in the format used by DIR/H:

MAP1 HSHSTR,s,4 ! Octal string byte

MAP1 STRING'HASH,s,15 ! Display format hash-total (###-###-###-###)

 

xcall MIAMEX,MX_HASHFILE,THISIPATH,HASH1,HASH2,HASH3,HASH4

xcall MIAMEX,MX_OCVT,HASH1,3,OT_MEM+OT_OCT,HSHSTR

STRING'HASH = HSHSTR+"-"

xcall MIAMEX,MX_OCVT,HASH2,3,OT_MEM+OT_OCT,HSHSTR

STRING'HASH = STRING'HASH+HSHSTR+"-"

xcall MIAMEX,MX_OCVT,HASH3,3,OT_MEM+OT_OCT,HSHSTR

STRING'HASH = STRING_HASH+HSHSTR+"-"

xcall MIAMEX,MX_OCVT,HASH4,3,OT_MEM+OT_OCT,HSHSTR

STRING'HASH = STRING'HASH+HSHSTR

print STRING'HASH

 

Note that for display purposes, the standard AMOS and A-Shell hash-total formats treat the numeric values as octal.

See Also

DIGEST.
HASH.SBR