Equity
Bitcoin Protocol Library
|
Represents a target value in both 256-bit hash form and compact form. More...
#include <Target.h>
Public Member Functions | |
Target (Crypto::Sha256Hash const &hash) | |
Target (uint32_t compact) | |
operator Crypto::Sha256Hash () const | |
Returns the hash form. | |
operator uint32_t () const | |
Returns the compact form. | |
double | difficulty () const |
Returns the associated difficulty value. | |
Static Public Member Functions | |
static Crypto::Sha256Hash | convertToHash (uint32_t compact) |
Computes the hash form based on the compact form. | |
static uint32_t | convertToCompact (Crypto::Sha256Hash const &hash) |
Computes the compact form based on the hash form. | |
Static Public Attributes | |
static uint32_t const | DIFFICULTY_1_COMPACT = 0x1d00ffff |
Target in compact form of difficulty 1. | |
static Crypto::Sha256Hash const | DIFFICULTY_1 |
Target in hash form of difficulty 1. More... | |
static uint32_t const | TARGET_0_COMPACT = 0x0100ffff |
Target value of 0 in compact form. | |
Represents a target value in both 256-bit hash form and compact form.
31 0 Format of the compact form: eeeeeeeesmmmmmmmmmmmmmmmmmmmmmmm
e is an 8-bit exponent (0 <= e <= 0x1d), s is a sign bit and m is a 23-bit unsigned mantissa (0 <= m <= 0x7fffff). The value represented by the compact form is m * 256^(e-3). Note that since the target value is always positive, s is always 0.
|
explicit |
hash | target in hash form |
|
explicit |
compact | target in compact form |
|
static |
Target in hash form of difficulty 1.