REBOL Document

Checksum - Function Summary


Summary:

Returns a CRC or other type of checksum.

Usage:

checksum data

Arguments:

data - Data to checksum (must be: any-string)

Refinements:

/tcp - Returns an Internet TCP 16-bit checksum.

/secure - Returns a cryptographically secure checksum.

/hash - Returns a hash value

size - Size of the hash table (must be: integer)

/method - Method to use

word - Method: SHA1 MD5 (must be: word)

/key - Returns keyed HMAC value

key-value - Key to use (must be: any-string)

Description:

Generally, a checksum is a number which accompanies data to verify that the data has not changed (did not have errors).


    print checksum "now is the dawning"
    9076108


    print checksum "how is the dawning"
    3266670

The /Secure refinement creates a binary string result that is cryptographically secure:


    print checksum/secure "fred-key"
    #{26EF1217114C035788A0D9A56A1772A6902CA42E}


    print checksum/secure form now
    #{6CC317901890D1C56E624859E48E945AD2B53229}

The /TCP refinement is used to compute the standard TCP networking checksum. This is a weak but fast checksum method.


    print checksum/tcp "now is the dawning"
    51574


    print checksum/tcp "how is the dawning"
    53110

Related:

any-string? - Returns TRUE for any-string values.
string? - Returns TRUE for string values.

User Comments:

-From: paul-tretter 7-Dec-2001/20:51:55-8:00:

Not sure of all the /methods but I know there is 'md5 method type for MD5 algorithm


<Back | Index | Next>

Copyright 2004 REBOL Technologies