(C) 1998 AROS - The Amiga Research OS


NAME
#include <proto/arossupport.h>

ULONG CalcChecksum ()

SYNOPSIS
APTR memory
ULONG size

FUNCTION
Calculate a checksum for a given area of memory.

INPUTS
memory
Start here
size
This many bytes. Must be a multiple of sizeof(ULONG)

RESULT
The checksum for the memory. If you store the checksum somewhere in the area and run CalcChecksum() again, the result will be 0. To achieve this, you must set the place, where the checksum will be placed later, to 0 before you call the function.

EXAMPLE
ULONG mem[512];

mem[0] = 0; // Store checksum here
mem[0] = CalcChecksum (mem, sizeof (mem));

if (CalcChecksum (mem, sizeof (mem))
    printf ("Something is wrong !!\n");
else
    printf ("Data is unchanged.\n");
SEE ALSO
SumKickData(), SumLibrary()

NOTES
This function is not part of a library and may thus be called any time.

BUGS

INTERNALS
The function uses the DOS way: sum all the ULONGs and return the negative result. Not very safe, but then it's quite fast :)

HISTORY
20.10.1998 hkiel
Amiga Research OS
27.03.1997 digulla
Removed AROS/compiler/aros/

Removed logs

Added comments

Replaced proto/aros.h by proto/arossupport.h and the like

Makefile is less noisy now, too

27.03.1997 ldp
libaros.a -> libarossupport.a