Functions | |
| unsigned int | bizarre_checksum (const byte *data, int length) |
| A different type of checksum with somewhat unknown properties. | |
| uint16 | fletcher_checksum (const byte *data, int length) |
| A positionally computed error detection value. | |
| uint16 | rolling_fletcher_checksum (uint16 previous, const byte *data, int len) |
| Fletcher checksums applied to streaming data. | |
| byte | byte_checksum (const byte *data, int length) |
| simple byte-sized checksum based on additive roll-over. | |
| u_int | short_checksum (const byte *data, int length) |
| simple shorty checksum based on additive roll-over. | |
| u_int | hash_bytes (const void *key_data, int key_length) |
| returns a value that can be used for indexing into a hash table. | |
| istring | timestamp (bool add_space=false, bool add_date=false) |
| Returns a string with the current time in hours, min, sec and ms. | |
| unsigned int utility::bizarre_checksum | ( | const byte * | data, | |
| int | length | |||
| ) |
A different type of checksum with somewhat unknown properties.
It attempts to be incorporate positioning of the bytes.
Definition at line 29 of file utility.cpp.
References HIGHEST_MOD_VALUE.
Referenced by do_checksum().
A positionally computed error detection value.
Definition at line 39 of file utility.cpp.
Referenced by internet_machine_uid::internet_machine_uid(), and rolling_fletcher_checksum().
| u_int utility::hash_bytes | ( | const void * | key_data, | |
| int | key_length | |||
| ) |
returns a value that can be used for indexing into a hash table.
the returned value is loosely based on the "key_data" and the "key_length" we are provided with.
Definition at line 97 of file utility.cpp.
Referenced by rotating_byte_hasher::hash().
Fletcher checksums applied to streaming data.
this is not strictly a fletcher checksum, but it uses the normal fletcher checksum on the specified data and XORs it with the "previous" value of the checksum. this leads to a regenerable number that should always be the same if done on the same data using the same chunking factor (the "len"), although of course the last piece of data does not have to be "len" bytes.
Definition at line 60 of file utility.cpp.
References fletcher_checksum().
Referenced by file_info::calculate(), and do_fletcher_checksum().
| istring utility::timestamp | ( | bool | add_space = false, |
|
| bool | add_date = false | |||
| ) |
Returns a string with the current time in hours, min, sec and ms.
"add_space" causes the stamp to have a space character after the outer bracket. "add_date" causes the stamp to include the current date as part of the stamp.
Definition at line 81 of file utility.cpp.
References earth_time::now().
Referenced by application_shell::log(), guards::make_error_message(), program_wide_logger(), post_office::show_mail(), hoople_api::low_level_methods::timestamp(), timestamp(), and critical_events::write_to_critical_events().
1.5.1