ocean.text.convert.Hash

Utility functions for converting hash_t <-> hexadecimal strings.

A few different types of data are handled: * Hex strings: strings of variable length containing valid hexadecimal digits (case insensitive), optionally prepended by the hex radix specifier ("0x") * Hash digests: hex strings of exactly hash_t.sizeof * 2 digits * hash_t

Members

Functions

hashDigestToHashT
bool hashDigestToHashT(cstring str, hash_t hash, bool allow_radix)

Converts from a hash digest (exactly HashDigits digits) to a hash_t.

isHashDigest
bool isHashDigest(cstring str, bool allow_radix)

Checks whether str is a hash digest.

toHashDigest
mstring toHashDigest(hash_t hash, mstring str)

Creates a hash digest string from a hash_t.

toHashT
bool toHashT(cstring str, hash_t hash, bool allow_radix)

Converts from a hex string to a hash_t.

Static variables

HashDigits
auto HashDigits;

Constant defining the number of hexadecimal digits needed to represent a hash_t.

Meta

License

Boost Software License Version 1.0. See LICENSE_BOOST.txt for details. Alternatively, this file may be distributed under the terms of the Tango 3-Clause BSD License (see LICENSE_BSD.txt for details).