28 for (
int i = 0; i < length; i++) sum += data[i] % 23 + i % 9;
30 return (
unsigned int)sum;
39 const abyte *buffer = data;
42 sum1 += int(*buffer++);
44 if (sum1 > 255) sum1++;
48 if (sum1 == 255) sum1 = 0;
63 for (
int i = 0; i < length; i++) to_return +=
abyte(data[i]);
70 for (
int i = 0; i < length; i++) to_return += data[i];
76 if (!key_data)
return 0;
77 if (!key_length)
return 0;
80 abyte hashed[4] = { 0, 0, 0, 0 };
83 for (
int i = 0; i < key_length; i++) {
85 hashed[fill_posn] = hashed[fill_posn] + our_key[i];
87 if (fill_posn >= 4) fill_posn = 0;
89 hashed[fill_posn] = hashed[fill_posn] + (our_key[i] / 4);
93 for (
int j = 0; j < 4; j++) to_return = (to_return << 8) + hashed[j];
static basis::un_int short_checksum(const basis::abyte *data, int length)
simple shorty checksum based on additive roll-over.
static basis::un_short rolling_fletcher_checksum(basis::un_short previous, const basis::abyte *data, int len)
Fletcher checksums applied to streaming data.
static basis::abyte byte_checksum(const basis::abyte *data, int length)
simple byte-sized checksum based on additive roll-over.
static unsigned int bizarre_checksum(const basis::abyte *data, int length)
A different type of checksum with somewhat unknown properties.
static basis::un_int hash_bytes(const void *key_data, int key_length)
returns a value that can be used for indexing into a hash table.
static basis::un_short fletcher_checksum(const basis::abyte *data, int length)
A positionally computed error detection value.
Constants and objects used throughout HOOPLE.
The guards collection helps in testing preconditions and reporting errors.
unsigned char abyte
A fairly important unit which is seldom defined...
unsigned int un_int
Abbreviated name for unsigned integers.
unsigned short un_short
Abbreviated name for unsigned short integers.
A dynamic container class that holds any kind of object via pointers.
const int HIGHEST_MOD_VALUE