HashVal

class HashVal

Stores a 128-bit value that represents the hashed contents (typically MD5) of a file or buffer.

Inheritance diagram

Inheritance diagram of HashVal

HashVal(void)
HashVal(HashVal const &copy)
vector_uchar as_bin(void) const

Returns the HashVal as a 16-byte binary string.

std::string as_dec(void) const

Returns the HashVal as a string with four decimal numbers.

std::string as_hex(void) const

Returns the HashVal as a 32-byte hexadecimal string.

int compare_to(HashVal const &other) const
void hash_buffer(char const *buffer, int length)

Generates the hash value by hashing the indicated data. This method is only defined if we have the OpenSSL library (which provides md5 functionality) available.

void hash_bytes(vector_uchar const &data)

Generates the hash value by hashing the indicated data. This method is only defined if we have the OpenSSL library (which provides md5 functionality) available.

bool hash_file(Filename const &filename)

Generates the hash value from the indicated file. Returns true on success, false if the file cannot be read. This method is only defined if we have the OpenSSL library (which provides md5 functionality) available.

void hash_ramfile(Ramfile const &ramfile)

Generates the hash value by hashing the indicated data. This method is only defined if we have the OpenSSL library (which provides md5 functionality) available.

bool hash_stream(std::istream &stream)

Generates the hash value from the indicated file. Returns true on success, false if the file cannot be read. This method is only defined if we have the OpenSSL library (which provides md5 functionality) available.

void hash_string(std::string const &data)

Generates the hash value by hashing the indicated data. This method is only defined if we have the OpenSSL library (which provides md5 functionality) available.

void input_binary(std::istream &in)

Inputs the HashVal as a binary stream of bytes in order. This is not the same order expected by read_stream().

void input_dec(std::istream &in)

Inputs the HashVal as four unsigned decimal integers.

void input_hex(std::istream &in)

Inputs the HashVal as a 32-digit hexadecimal number.

void merge_with(HashVal const &other)

Generates a new HashVal representing the xor of this one and the other one.

void output(std::ostream &out) const
void output_binary(std::ostream &out) const

Outputs the HashVal as a binary stream of bytes in order. This is not the same order generated by write_stream().

void output_dec(std::ostream &out) const

Outputs the HashVal as four unsigned decimal integers.

void output_hex(std::ostream &out) const

Outputs the HashVal as a 32-digit hexadecimal number.

void read_datagram(DatagramIterator &source)
void read_stream(StreamReader &source)
bool set_from_bin(vector_uchar const &text)

Sets the HashVal from a 16-byte binary string. Returns true if successful, false otherwise.

bool set_from_dec(std::string const &text)

Sets the HashVal from a string with four decimal numbers. Returns true if valid, false otherwise.

bool set_from_hex(std::string const &text)

Sets the HashVal from a 32-byte hexademical string. Returns true if successful, false otherwise.

void write_datagram(Datagram &destination) const
void write_stream(StreamWriter &destination) const