|
Ring Daemon
|
Namespaces | |
| namespace | crypto |
| namespace | keccak |
Classes | |
| class | FixedHash |
| Fixed-size raw-byte array container type, with an API optimised for storing hashes. More... | |
| class | KeyPair |
| Simple class that represents a "key pair". More... | |
| class | ScopeGuard |
| RAII utility class whose destructor calls a given function. More... | |
| class | SecureFixedHash |
| struct | SignatureStruct |
| struct | StaticLog2 |
| Compile-time calculation of Log2 of constant values. More... | |
| struct | StaticLog2< 1 > |
| class | vector_ref |
| A modifiable reference to an existing object or vector in memory. More... | |
Typedefs | |
| using | Address = h160 |
| An Ethereum address: 20 bytes. | |
| using | Addresses = h160s |
| A vector of Ethereum addresses. | |
| using | AddressHash = std::unordered_set< h160 > |
| A hash set of Ethereum addresses. | |
| using | bytes = std::vector< uint8_t > |
| using | bytesConstRef = vector_ref< uint8_t const > |
| using | BytesMap = std::map< bytes, bytes > |
| using | bytesRef = vector_ref< uint8_t > |
| using | h1024 = FixedHash< 128 > |
| using | h128 = FixedHash< 16 > |
| using | h160 = FixedHash< 20 > |
| using | h160Hash = std::unordered_set< h160 > |
| using | h160s = std::vector< h160 > |
| using | h160Set = std::set< h160 > |
| using | h2048 = FixedHash< 256 > |
| using | h256 = FixedHash< 32 > |
| using | h256Hash = std::unordered_set< h256 > |
| using | h256s = std::vector< h256 > |
| using | h256Set = std::set< h256 > |
| using | h512 = FixedHash< 64 > |
| using | h512s = std::vector< h512 > |
| using | h520 = FixedHash< 65 > |
| using | h64 = FixedHash< 8 > |
| using | HexMap = std::map< bytes, bytes > |
| using | Public = h512 |
| A public key: 64 bytes. | |
| using | Secret = SecureFixedHash< 32 > |
| using | Secrets = std::vector< Secret > |
| A vector of secrets. | |
| using | Signature = h520 |
| A signature: 65 bytes: r: [0, 32), s: [32, 64), v: 64. | |
| using | string32 = std::array< char, 32 > |
| using | StringHashMap = std::unordered_map< std::string, std::string > |
| using | StringMap = std::map< std::string, std::string > |
| using | strings = std::vector< std::string > |
Enumerations | |
| enum class | WhenError { DontThrow = 0 , Throw = 1 } |
| enum class | WithExisting : int { Trust = 0 , Verify , Rescue , Kill } |
Functions | |
| bytes | asBytes (std::string const &_b) |
| Converts a string to a byte array containing the string's (byte) data. | |
| bytes | asNibbles (bytesConstRef const &_s) |
| std::string | asString (bytes const &_b) |
| Converts byte array to a string containing the same (binary) data. | |
| std::string | asString (bytesConstRef _b) |
| Converts byte array ref to a string containing the same (binary) data. | |
| template<class T , class _U > | |
| unsigned | commonPrefix (T const &_t, _U const &_u) |
| template<class T , class V > | |
| bool | contains (T const &_t, V const &_v) |
| template<class N > | |
| N | diff (N const &_a, N const &_b) |
| template<class T , class _In > | |
| T | fromBigEndian (_In const &_bytes) |
| Converts a big-endian byte-stream represented on a templated collection to a templated integer value. | |
| bytes | fromHex (std::string const &_s, WhenError _throw=WhenError::DontThrow) |
| template<class T > | |
| static bool | isHash (std::string const &_hash) |
| bool | isHex (std::string const &_s) noexcept |
| template<class T , class U > | |
| std::vector< T > | keysOf (std::map< T, U > const &_m) |
| template<class T , class U > | |
| std::vector< T > | keysOf (std::unordered_map< T, U > const &_m) |
| template<class T , class U > | |
| std::set< T > | operator+ (std::set< T > _a, U const &_b) |
| Insert the contents of a container into a set. | |
| template<class T , class U > | |
| std::unordered_set< T > | operator+ (std::unordered_set< T > _a, U const &_b) |
| Insert the contents of a container into an unordered_set. | |
| template<class T , class U > | |
| std::vector< T > | operator+ (std::vector< T > _a, U const &_b) |
| Concatenate the contents of a container onto a vector. | |
| template<class T > | |
| std::vector< T > | operator+ (std::vector< T > const &_a, std::vector< T > const &_b) |
| Concatenate two vectors of elements. | |
| template<class T , class U > | |
| std::set< T > & | operator+= (std::set< T > &_a, U const &_b) |
| Insert the contents of a container into a set. | |
| template<class T , class U > | |
| std::unordered_set< T > & | operator+= (std::unordered_set< T > &_a, U const &_b) |
| Insert the contents of a container into an unordered_set. | |
| template<class T , class U > | |
| std::vector< T > & | operator+= (std::vector< T > &_a, U const &_b) |
| Concatenate the contents of a container onto a vector. | |
| template<class T > | |
| std::vector< T > & | operator+= (std::vector< typename std::enable_if< std::is_pod< T >::value, T >::type > &_a, std::vector< T > const &_b) |
| Concatenate two vectors of elements of POD types. | |
| template<class T > | |
| std::vector< T > & | operator+= (std::vector< typename std::enable_if<!std::is_pod< T >::value, T >::type > &_a, std::vector< T > const &_b) |
| Concatenate two vectors of elements. | |
| template<class T , class _U > | |
| void | pushFront (T &_t, _U _e) |
| Pushes an element on to the front of a collection. | |
| template<class _T > | |
| vector_ref< _T > | ref (_T &_t) |
| template<class _T > | |
| vector_ref< _T const > | ref (_T const &_t) |
| template<class _T > | |
| vector_ref< _T > | ref (std::vector< _T > &_t) |
| template<class _T > | |
| vector_ref< _T const > | ref (std::vector< _T > const &_t) |
| h160 | right160 (h256 const &_t) |
| Convert the given value into h160 (160-bit unsigned integer) using the right 20 bytes. | |
| h256 | sha3 (bytes const &_input) |
| Calculate SHA3-256 hash of the given input, returning as a 256-bit hash. | |
| h256 | sha3 (bytesConstRef _input) |
| Calculate SHA3-256 hash of the given input, returning as a 256-bit hash. | |
| bool | sha3 (bytesConstRef _input, bytesRef o_output) |
| Calculate SHA3-256 hash of the given input and load it into the given output. | |
| template<unsigned N> | |
| h256 | sha3 (FixedHash< N > const &_input) |
| Calculate SHA3-256 hash of the given input (presented as a FixedHash), returns a 256-bit hash. | |
| h256 | sha3 (std::string const &_input) |
| Calculate SHA3-256 hash of the given input (presented as a binary-filled string), returning as a 256-bit hash. | |
| std::string | sha3 (std::string const &_input, bool _isNibbles) |
| Calculate SHA3-256 hash of the given input, possibly interpreting it as nibbles, and return the hash as a string filled with binary data. | |
| Address | toAddress (Public const &_public) |
| Convert a public key to address. | |
| Address | toAddress (Secret const &_secret) |
| Convert a secret key into address of public key equivalent. | |
| bytes | toCompactBigEndian (uint8_t _val, unsigned _min=0) |
| template<class Iterator > | |
| std::string | toHex (Iterator _it, Iterator _end, std::string _prefix) |
| template<class T > | |
| std::string | toHex (T const &_data) |
| template<class T > | |
| std::string | toHexPrefixed (T const &_data) |
| Public | toPublic (Secret const &_secret) |
| Convert a secret key into the public key equivalent. | |
| template<class T > | |
| void | trimFront (T &_t, unsigned _elements) |
| Trims a given number of elements from the front of a collection. | |
| template<class T , class U > | |
| std::vector< U > | valuesOf (std::map< T, U > const &_m) |
| template<class T , class U > | |
| std::vector< U > | valuesOf (std::unordered_map< T, U > const &_m) |
Variables | |
| h256 | EmptySHA3 = sha3(bytesConstRef()) |
| std::string const | EmptyString |
| char const * | Version |
| typedef h160 dev::Address |
| using dev::Addresses = typedef h160s |
| using dev::AddressHash = typedef std::unordered_set<h160> |
| using dev::bytes = typedef std::vector<uint8_t> |
Definition at line 72 of file libdevcore/Common.h.
| using dev::bytesConstRef = typedef vector_ref<uint8_t const> |
Definition at line 74 of file libdevcore/Common.h.
| using dev::BytesMap = typedef std::map<bytes, bytes> |
Definition at line 78 of file libdevcore/Common.h.
| using dev::bytesRef = typedef vector_ref<uint8_t> |
Definition at line 73 of file libdevcore/Common.h.
| using dev::h1024 = typedef FixedHash<128> |
Definition at line 465 of file FixedHash.h.
Definition at line 470 of file FixedHash.h.
Definition at line 469 of file FixedHash.h.
| using dev::h160Hash = typedef std::unordered_set<h160> |
Definition at line 478 of file FixedHash.h.
| using dev::h160s = typedef std::vector<h160> |
Definition at line 474 of file FixedHash.h.
| using dev::h160Set = typedef std::set<h160> |
Definition at line 476 of file FixedHash.h.
| using dev::h2048 = typedef FixedHash<256> |
Definition at line 464 of file FixedHash.h.
Definition at line 468 of file FixedHash.h.
| using dev::h256Hash = typedef std::unordered_set<h256> |
Definition at line 477 of file FixedHash.h.
| using dev::h256s = typedef std::vector<h256> |
Definition at line 473 of file FixedHash.h.
| using dev::h256Set = typedef std::set<h256> |
Definition at line 475 of file FixedHash.h.
Definition at line 467 of file FixedHash.h.
| using dev::h512s = typedef std::vector<h512> |
Definition at line 472 of file FixedHash.h.
Definition at line 466 of file FixedHash.h.
Definition at line 471 of file FixedHash.h.
| using dev::HexMap = typedef std::map<bytes, bytes> |
Definition at line 79 of file libdevcore/Common.h.
| using dev::Public = typedef h512 |
A public key: 64 bytes.
@NOTE This is not endian-specific; it's just a bunch of bytes.
Definition at line 38 of file libdevcrypto/Common.h.
| using dev::Secret = typedef SecureFixedHash<32> |
Definition at line 34 of file libdevcrypto/Common.h.
| using dev::Secrets = typedef std::vector<Secret> |
A vector of secrets.
Definition at line 64 of file libdevcrypto/Common.h.
| using dev::Signature = typedef h520 |
A signature: 65 bytes: r: [0, 32), s: [32, 64), v: 64.
@NOTE This is not endian-specific; it's just a bunch of bytes.
Definition at line 42 of file libdevcrypto/Common.h.
| using dev::string32 = typedef std::array<char, 32> |
Definition at line 88 of file libdevcore/Common.h.
| using dev::StringHashMap = typedef std::unordered_map<std::string, std::string> |
Definition at line 82 of file libdevcore/Common.h.
| using dev::StringMap = typedef std::map<std::string, std::string> |
Definition at line 77 of file libdevcore/Common.h.
| using dev::strings = typedef std::vector<std::string> |
Definition at line 85 of file libdevcore/Common.h.
|
strong |
| Enumerator | |
|---|---|
| DontThrow | |
| Throw | |
Definition at line 38 of file CommonData.h.
|
strong |
| Enumerator | |
|---|---|
| Trust | |
| Verify | |
| Rescue | |
| Kill | |
Definition at line 118 of file libdevcore/Common.h.
|
inline |
Converts a string to a byte array containing the string's (byte) data.
Definition at line 115 of file CommonData.h.
Referenced by sha3().
| bytes dev::asNibbles | ( | bytesConstRef const & | _s | ) |
Definition at line 82 of file CommonData.cpp.
References dev::vector_ref< _T >::size().

|
inline |
Converts byte array to a string containing the same (binary) data.
Unless the byte array happens to contain ASCII data, this won't be printable.
Definition at line 100 of file CommonData.h.
Referenced by sha3().
|
inline |
Converts byte array ref to a string containing the same (binary) data.
Unless the byte array happens to contain ASCII data, this won't be printable.
Definition at line 108 of file CommonData.h.
References dev::vector_ref< _T >::data(), and dev::vector_ref< _T >::size().

| unsigned dev::commonPrefix | ( | T const & | _t, |
| _U const & | _u | ||
| ) |
Definition at line 153 of file CommonData.h.
| bool dev::contains | ( | T const & | _t, |
| V const & | _v | ||
| ) |
Definition at line 314 of file CommonData.h.
|
inline |
Definition at line 93 of file libdevcore/Common.h.
|
inline |
Converts a big-endian byte-stream represented on a templated collection to a templated integer value.
_In will typically be either std::string or bytes. T will typically by unsigned, u160, u256 or bigint.
Definition at line 132 of file CommonData.h.
| bytes dev::fromHex | ( | std::string const & | _s, |
| WhenError | _throw = WhenError::DontThrow |
||
| ) |
Definition at line 53 of file CommonData.cpp.
Referenced by sha3().
|
static |
Definition at line 91 of file CommonData.h.
References isHex().

|
noexcept |
Referenced by isHash().
| std::vector< T > dev::keysOf | ( | std::map< T, U > const & | _m | ) |
Definition at line 272 of file CommonData.h.
| std::vector< T > dev::keysOf | ( | std::unordered_map< T, U > const & | _m | ) |
Definition at line 282 of file CommonData.h.
| std::set< T > dev::operator+ | ( | std::set< T > | _a, |
| U const & | _b | ||
| ) |
Insert the contents of a container into a set.
Definition at line 240 of file CommonData.h.
| std::unordered_set< T > dev::operator+ | ( | std::unordered_set< T > | _a, |
| U const & | _b | ||
| ) |
Insert the contents of a container into an unordered_set.
Definition at line 248 of file CommonData.h.
| std::vector< T > dev::operator+ | ( | std::vector< T > | _a, |
| U const & | _b | ||
| ) |
Concatenate the contents of a container onto a vector.
Definition at line 256 of file CommonData.h.
|
inline |
Concatenate two vectors of elements.
Definition at line 264 of file CommonData.h.
| std::set< T > & dev::operator+= | ( | std::set< T > & | _a, |
| U const & | _b | ||
| ) |
Insert the contents of a container into a set.
Definition at line 210 of file CommonData.h.
| std::unordered_set< T > & dev::operator+= | ( | std::unordered_set< T > & | _a, |
| U const & | _b | ||
| ) |
Insert the contents of a container into an unordered_set.
Definition at line 220 of file CommonData.h.
| std::vector< T > & dev::operator+= | ( | std::vector< T > & | _a, |
| U const & | _b | ||
| ) |
Concatenate the contents of a container onto a vector.
Definition at line 230 of file CommonData.h.
|
inline |
Concatenate two vectors of elements of POD types.
Definition at line 188 of file CommonData.h.
|
inline |
Concatenate two vectors of elements.
Definition at line 199 of file CommonData.h.
| void dev::pushFront | ( | T & | _t, |
| _U | _e | ||
| ) |
Pushes an element on to the front of a collection.
Only works for POD element types.
Definition at line 177 of file CommonData.h.
| vector_ref< _T > dev::ref | ( | _T & | _t | ) |
Definition at line 190 of file vector_ref.h.
| vector_ref< _T const > dev::ref | ( | _T const & | _t | ) |
Definition at line 184 of file vector_ref.h.
| vector_ref< _T > dev::ref | ( | std::vector< _T > & | _t | ) |
Definition at line 202 of file vector_ref.h.
| vector_ref< _T const > dev::ref | ( | std::vector< _T > const & | _t | ) |
Definition at line 196 of file vector_ref.h.
Convert the given value into h160 (160-bit unsigned integer) using the right 20 bytes.
Definition at line 482 of file FixedHash.h.
References dev::FixedHash< N >::data().
Referenced by toAddress().

|
inline |
Calculate SHA3-256 hash of the given input, returning as a 256-bit hash.
Definition at line 40 of file SHA3.h.
References dev::FixedHash< N >::ref(), and sha3().

| bool dev::sha3 | ( | bytesConstRef | _input, |
| bytesRef | o_output | ||
| ) |
Calculate SHA3-256 hash of the given input (presented as a FixedHash), returns a 256-bit hash.
Definition at line 65 of file SHA3.h.
References dev::FixedHash< N >::ref(), and sha3().

|
inline |
|
inline |
Convert a public key to address.
Definition at line 79 of file Common.cpp.
References dev::FixedHash< N >::ref(), right160(), and sha3().
Referenced by dev::KeyPair::KeyPair(), and toAddress().

Convert a secret key into address of public key equivalent.
Definition at line 85 of file Common.cpp.
References toAddress(), and toPublic().

|
inline |
Definition at line 141 of file CommonData.h.
| std::string dev::toHex | ( | Iterator | _it, |
| Iterator | _end, | ||
| std::string | _prefix | ||
| ) |
Definition at line 45 of file CommonData.h.
Referenced by dev::FixedHash< N >::abridged(), dev::FixedHash< N >::abridgedMiddle(), dev::FixedHash< N >::hex(), toHex(), and toHexPrefixed().
| std::string dev::toHex | ( | T const & | _data | ) |
Definition at line 65 of file CommonData.h.
References toHex().

| std::string dev::toHexPrefixed | ( | T const & | _data | ) |
Definition at line 74 of file CommonData.h.
References toHex().

Convert a secret key into the public key equivalent.
Definition at line 57 of file Common.cpp.
References dev::FixedHash< N >::ConstructFromPointer, and dev::SecureFixedHash< T >::data().
Referenced by toAddress().

| void dev::trimFront | ( | T & | _t, |
| unsigned | _elements | ||
| ) |
Trims a given number of elements from the front of a collection.
Only works for POD element types.
Definition at line 166 of file CommonData.h.
| std::vector< U > dev::valuesOf | ( | std::map< T, U > const & | _m | ) |
Definition at line 292 of file CommonData.h.
| std::vector< U > dev::valuesOf | ( | std::unordered_map< T, U > const & | _m | ) |
Definition at line 303 of file CommonData.h.
| h256 dev::EmptySHA3 = sha3(bytesConstRef()) |
|
extern |
|
extern |