Extending the Apple IIGS Toolbox

If data integrity needs to be verified, it can be done on an Apple IIGS
About >
The Hash tool set allows GS/OS applications to create a "fingerprint" or message digest from a block of data. The tool set currently provides md2, md4, md5, and sha1 checksums. This software is available as open-source ing the GNU Public License. License information is found in the Tool128.asm file in the downloadable contents.

Orca/M and Orca/C is needed to build the tool set.
References >
MD2: http://www.ietf.org/rfc/rfc1115.txt
MD2: http://www.ietf.org/rfc/rfc1319.txt
MD4: http://www.ietf.org/rfc/rfc1320.txt
MD5: http://www.ietf.org/rfc/rfc1321.txt
SHA1: http://www.ietf.org/rfc/rfc3174.txt
Support >
Support for the Hash Tool can be found on the #a2c.chat irc channel on irc.a2central.com.

January 2011: Hash Tool 128 Version 1.3 released. Added support for md2 and sha1. Renamed tool calls for compatibility with other environments (legacy names still supported--developers are encouraged to use the new names).

June 2004: Hash Tool 128 Version 1.2 released. Fixed a memory corruption bug in both md5 and md4 if the DBR and the PBR are the same.
Download >
Apple IIGS Disk Image: HashTool.po
Note: Real Apple IIGS users will need to use a utility such as MountIt to access the contents since it can mount disk images.

You may need to set your Web Browser's MIME type to allow download of this file. MIME type is application/vnd.apple2-prodos-disk-image with the extension of "po". This type should always be set to save to disk. Please review your Web Browser's help documentation to set MIME types.
Tool Documentation >
===========================================================================
                           Tool 128 Reference
===========================================================================

$0180 hashBootInit
 
Initializes the Hash Tool Set; called only by the Tool Locator.
Applications must never make this call.
 
Parameters:
 
The stack is not affected by this call.  There are no input or output
parameters.
 
Errors:
 
None
 
C
 
extern pascal void hashBootInit();
 
 
$0280 hashStartUp
 
Starts up the Hash Tool Set for use by an application.
 
Parameters:
 
The stack is not affected by this call.  There are no input or output
parameters.
 
Errors:
 
None
 
C
 
extern pascal void hashStartUp();
 
 
$0380 hashShutDown
 
Shuts down the Hash Tool Set for use by an application.  If your
application has started up the Hash Tool Set, the application must
make this call before it quits.
 
Parameters:
 
The stack is not affected by this call.  There are no input or output
parameters.
 
Errors:
 
None
 
C
 
extern pascal void hashShutDown();
 
 
$0480 hashVersion
 
Returns the version number of the Hash Tool Set.
 
Parameters:
 
Stack Before Call
|________________________________|
|           wordspace            | word -- space for result
|________________________________|
|                                | <- SP
 
Stack After Call
|________________________________|
|          versionInfo           | word -- version number
|________________________________|
|                                | <- SP
 
Errors:
 
None
 
C
 
extern pascal Word hashVersion();
 
 
$0580 hashReset
 
Sends a reset to the Hash Tool Set; called only when the system is reset.
Applications must never make this call.
 
Parameters:
 
The stack is not affected by this call.  There are no input or output
parameters.
 
Errors:
 
None
 
C
 
extern pascal void hashReset();
 
 
$0680 hashStatus
 
Indicates whether the Hash Tool Set is active.
 
Parameters:
 
Stack Before Call
|________________________________|
|           wordspace            | word -- space for result
|________________________________|
|                                | <- SP
 
Stack After Call
|________________________________|
|          activeFlag            | word -- BOOLEAN; True if tool set is 
|________________________________|         active, false if not.
|                                | <- SP
 
Errors:
 
None
 
C
 
extern pascal Word hashStatus();
 
 
$0980 md5Init
 
This call initializes the work block for md5 use.  This must be called before
any md5Append.  The message digest will generate incorrectly if this call is
not made.
 
Parameters:
 
Stack Before Call
|________________________________|
|          md5WorkBlkPtr         | mdWorkBlockPtr -- pointer to a
|__                           ___|                   mdWorkBlock
|                                |
|________________________________|
|                                | <- SP
 
Stack After Call
|________________________________|
|                                | <- SP
 
Errors:
 
None
 
C
 
extern pascal void md5Init(md5WorkBlkPtr);
mdWorkBlockPtr md5WorkBlkPtr;
 
 
$0A80 md5Append
 
This takes a block of data and takes the message digest of its contents and
appends the information to the mdWorkBlock.  The block of memory can be 0
bytes long.  This call may be used multiple times before calling md5Finish.
 
Parameters:
 
Stack Before Call
|________________________________|
|          md5WorkBlkPtr         | mdWorkBlockPtr -- pointer to a 
|__                           ___|                   mdWorkBlock
|                                |
|________________________________|
|            memoryPtr           | Ptr -- pointer to a block of memory
|__                           ___|
|                                |
|________________________________|
|          memoryLength          | long -- length of block
|__                           ___|
|                                |
|________________________________|
|                                | <- SP
 
Stack After Call
|________________________________|
|                                | <- SP
 
Errors:
 
None
 
C
 
extern pascal void md5Append(md5WorkBlkPtr, memoryPtr, memoryLength);
mdWorkBlockPtr md5WorkBlkPtr;
Ptr memoryPtr;
Long memoryLength;
 
 
$0B80 md5Finish
 
This produces the final md5 message digest.
 
Parameters:
 
Stack Before Call
|________________________________|
|          md5WorkBlkPtr         | mdWorkBlockPtr -- pointer to a
|__                           ___|                   mdWorkBlock
|                                |
|________________________________|
|            digestPtr           | Ptr -- pointer to digest space
|__                           ___|
|                                |
|________________________________|
|                                | <- SP
 
Stack After Call
|________________________________|
|                                | <- SP
 
Errors:
 
None
 
C
 
extern pascal void md5Finish(md5WorkBlkPtr, digestPtr);
mdWorkBlockPtr md5WorkBlkPtr;
Ptr digestPtr;
 
 
$0C80 md4Init
 
This call initializes the md4 work block.  This must be called before any
md4Append.  The message digest will generate incorrectly if this call is
not made.
 
Parameters:
 
Stack Before Call
|________________________________|
|          md4WorkBlkPtr         | mdWorkBlockPtr -- pointer to a
|__                           ___|                   mdWorkBlock
|                                |
|________________________________|
|                                | <- SP
 
Stack After Call
|________________________________|
|                                | <- SP
 
Errors:
 
None
 
C
 
extern pascal void md4Init(md4WorkBlkPtr);
mdWorkBlockPtr md4WorkBlkPtr;
 
 
$0D80 md4Append
 
This takes a block of data and takes the message digest of its contents and
appends the information to the mdWorkBlock.  The block of memory can be 0
bytes long.  This call may be used multiple times before calling md4Finish.
 
Parameters:
 
Stack Before Call
|________________________________|
|          md4WorkBlkPtr         | mdWorkBlockPtr -- pointer to a 
|__                           ___|                   mdWorkBlock
|                                |
|________________________________|
|            memoryPtr           | Ptr -- pointer to a block of memory
|__                           ___|
|                                |
|________________________________|
|          memoryLength          | long -- length of block
|__                           ___|
|                                |
|________________________________|
|                                | <- SP
 
Stack After Call
|________________________________|
|                                | <- SP
 
Errors:
 
None
 
C
 
extern pascal void md4Append(md4WorkBlkPtr, memoryPtr, memoryLength);
mdWorkBlockPtr md4WorkBlkPtr;
Ptr memoryPtr;
Long memoryLength;
 
 
$0E80 md4Finish
 
This produces the final md4 message digest.
 
Parameters:
 
Stack Before Call
|________________________________|
|          md4WorkBlkPtr         | mdWorkBlockPtr -- pointer to a
|__                           ___|                   mdWorkBlock
|                                |
|________________________________|
|            digestPtr           | Ptr -- pointer to digest space
|__                           ___|
|                                |
|________________________________|
|                                | <- SP
 
Stack After Call
|________________________________|
|                                | <- SP
 
Errors:
 
None
 
C
 
extern pascal void md4Finish(md4WorkBlkPtr, digestPtr);
mdWorkBlockPtr md4WorkBlkPtr;
Ptr digestPtr;
 
 
$0F80 md2Init
 
This call initializes the md2 work block.  This must be called before any
md2Append.  The message digest will generate incorrectly if this call is
not made.
 
Parameters:
 
Stack Before Call
|________________________________|
|          md2WorkBlkPtr         | mdWorkBlockPtr -- pointer to a
|__                           ___|                   mdWorkBlock
|                                |
|________________________________|
|                                | <- SP
 
Stack After Call
|________________________________|
|                                | <- SP
 
Errors:
 
None
 
C
 
extern pascal void md2Init(md2WorkBlkPtr);
mdWorkBlockPtr md2WorkBlkPtr;
 
 
$1080 md2Append
 
This takes a block of data and takes the message digest of its contents and
appends the information to the mdWorkBlock.  The block of memory can be 0
bytes long.  This call may be used multiple times before calling md2Finish.
 
Parameters:
 
Stack Before Call
|________________________________|
|          md2WorkBlkPtr         | mdWorkBlockPtr -- pointer to a 
|__                           ___|                   mdWorkBlock
|                                |
|________________________________|
|            memoryPtr           | Ptr -- pointer to a block of memory
|__                           ___|
|                                |
|________________________________|
|          memoryLength          | long -- length of block
|__                           ___|
|                                |
|________________________________|
|                                | <- SP
 
Stack After Call
|________________________________|
|                                | <- SP
 
Errors:
 
None
 
C
 
extern pascal void md2Append(md2WorkBlkPtr, memoryPtr, memoryLength);
mdWorkBlockPtr md2WorkBlkPtr;
Ptr memoryPtr;
Long memoryLength;
 
 
$1180 md2Finish
 
This produces the final md2 message digest.
 
Parameters:
 
Stack Before Call
|________________________________|
|          md2WorkBlkPtr         | mdWorkBlockPtr -- pointer to a
|__                           ___|                   mdWorkBlock
|                                |
|________________________________|
|            digestPtr           | Ptr -- pointer to digest space
|__                           ___|
|                                |
|________________________________|
|                                | <- SP
 
Stack After Call
|________________________________|
|                                | <- SP
 
Errors:
 
None
 
C
 
extern pascal void md2Finish(md2WorkBlkPtr, digestPtr);
mdWorkBlockPtr md2WorkBlkPtr;
Ptr digestPtr;

 
$1280 sha1Init
 
This call initializes the sha1 work block.  This must be called before any
sha1Append.  The message digest will generate incorrectly if this call is
not made.
 
Parameters:
 
Stack Before Call
|________________________________|
|         sha1WorkBlkPtr         | mdWorkBlockPtr -- pointer to a
|__                           ___|                   mdWorkBlock
|                                |
|________________________________|
|                                | <- SP
 
Stack After Call
|________________________________|
|                                | <- SP
 
Errors:
 
None
 
C
 
extern pascal void sha1Init(sha1WorkBlkPtr);
mdWorkBlockPtr sha1WorkBlkPtr;
 
 
$1380 sha1Append
 
This takes a block of data and takes the message digest of its contents and
appends the information to the mdWorkBlock.  The block of memory can be 0
bytes long.  This call may be used multiple times before calling sha1Finish.
 
Parameters:
 
Stack Before Call
|________________________________|
|         sha1WorkBlkPtr         | mdWorkBlockPtr -- pointer to a 
|__                           ___|                   mdWorkBlock
|                                |
|________________________________|
|            memoryPtr           | Ptr -- pointer to a block of memory
|__                           ___|
|                                |
|________________________________|
|          memoryLength          | long -- length of block
|__                           ___|
|                                |
|________________________________|
|                                | <- SP
 
Stack After Call
|________________________________|
|                                | <- SP
 
Errors:
 
None
 
C
 
extern pascal void sha1Append(sha1WorkBlkPtr, memoryPtr, memoryLength);
mdWorkBlockPtr sha1WorkBlkPtr;
Ptr memoryPtr;
Long memoryLength;
 
 
$1480 sha1Finish
 
This produces the final sha1 message digest.
 
Parameters:
 
Stack Before Call
|________________________________|
|         sha1WorkBlkPtr         | mdWorkBlockPtr -- pointer to a
|__                           ___|                   mdWorkBlock
|                                |
|________________________________|
|            digestPtr           | Ptr -- pointer to digest space
|__                           ___|
|                                |
|________________________________|
|                                | <- SP
 
Stack After Call
|________________________________|
|                                | <- SP
 
Errors:
 
None
 
C
 
extern pascal void sha1Finish(sha1WorkBlkPtr, digestPtr);
mdWorkBlockPtr sha1WorkBlkPtr;
Ptr digestPtr;


---------------------------------------------------------------------------
 
Known Bugs:
            None.