BitBlob

A value type representing a hash

Constructors

this
this(ubyte[] bin, bool isLE)

Create a BitBlob from binary data, e.g. serialized data

this
this(const(char)[] hexstr)

Create a BitBlob from an hexadecimal string representation

Members

Functions

isNull
bool isNull()
opCmp
int opCmp(typeof(this) s)
Undocumented in source. Be warned that the author may not have intended to support it.
opIndex
const(ubyte)[] opIndex()

Used for sha256Of

toString
void toString(void delegate(const(char)[]) @(safe) sink)

Used by std.format Cannot be nothrow @nogc since sformat is not, but does not allocate

toString
string toString()

Used for serialization

Static functions

fromHex
ubyte fromHex(char c)

Public because of a visibility bug

fromString
auto fromString(const(char)[] str)

Used for deserialization

Static variables

Width
auto Width;

The width of this aggregate, in octets

Parameters

Bits

The size of the hash, in bits. Must be a multiple of 8.

Examples

Test toString

import std.format;
alias Hash = BitBlob!256;
Hash gen1 = GenesisBlockHashStr;
assert(format("%s", gen1) == GenesisBlockHashStr);

Meta