REBOL 3 Docs Guide Concepts Functions Datatypes Errors
  TOC < Back Next >   Updated: 3-Aug-2010 Edit History  

REBOL 3 Functions: checksum

checksum  data  /tcp  /secure  /hash  size  /method  word  /key  key-value

Computes a checksum, CRC, or hash.

Arguments:

data [binary!] - Byte string to checksum

Refinements:

/tcp - Returns an Internet TCP 16-bit checksum

/secure - Returns a cryptographically secure checksum

/hash - Returns a hash value

size [integer!] - Size of the hash table

/method - Method to use

word [word!] - Method: SHA1 MD5

/key - Returns keyed HMAC value

key-value [any-string!] - Key to use

See also:

string?   any-string?  

Description

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

Editor note: R3 does not yet allow string! for checksums.

print checksum "now is the dawning"

print checksum "how is the dawning"

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

print checksum/secure "fred-key"

print checksum/secure form now

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"

print checksum/tcp "how is the dawning"


  TOC < Back Next > REBOL.com - WIP Wiki Feedback Admin