TARAXA
dev Namespace Reference

Namespaces

 con
 
 crypto
 
 eth
 
 p2p
 

Classes

class  secure_vector
 
class  ScopeGuard
 RAII utility class whose destructor calls a given function. More...
 
class  TimerHelper
 Simple scope-based timer helper. More...
 
class  Timer
 
struct  StreamOut
 
struct  StreamOut< uint8_t >
 
struct  Exception
 Base class for all exceptions. More...
 
struct  RLPException
 Base class for all RLP exceptions. More...
 
struct  StaticLog2
 Compile-time calculation of Log2 of constant values. More...
 
struct  StaticLog2< 1 >
 
class  FixedHash
 
class  SecureFixedHash
 
struct  GenericGuardBool
 
struct  GenericUnguardBool
 
struct  GenericUnguardSharedBool
 
class  Notified
 
struct  intTraits
 
struct  intTraits< u160 >
 
struct  intTraits< u256 >
 
struct  intTraits< bigint >
 
struct  Converter
 
class  RLP
 
struct  Converter< std::string >
 
struct  Converter< bytes >
 
struct  Converter< uint8_t >
 
struct  Converter< uint16_t >
 
struct  Converter< uint32_t >
 
struct  Converter< uint64_t >
 
struct  Converter< u160 >
 
struct  Converter< u256 >
 
struct  Converter< bigint >
 
struct  Converter< FixedHash< N > >
 
struct  Converter< std::pair< T, U > >
 
struct  Converter< std::vector< T > >
 
struct  Converter< std::set< T > >
 
struct  Converter< std::unordered_set< T > >
 
struct  Converter< std::array< T, N > >
 
class  RLPStream
 Class for writing to an RLP bytestream. More...
 
class  vector_ref
 
struct  SignatureStruct
 
struct  CompactSignatureStruct
 
class  KeyPair
 

Typedefs

using Address = h160
 
using Addresses = h160s
 A vector of Ethereum addresses. More...
 
using AddressSet = std::unordered_set< h160 >
 A hash set of Ethereum addresses. More...
 
using errinfo_comment = boost::error_info< struct tag_comment, std::string >
 
using bytes = std::vector<::byte >
 
using bytesRef = vector_ref<::byte >
 
using bytesConstRef = vector_ref<::byte const >
 
using bytesSec = secure_vector<::byte >
 
using bigint = boost::multiprecision::number< boost::multiprecision::cpp_int_backend<> >
 
using u64 = boost::multiprecision::number< boost::multiprecision::cpp_int_backend< 64, 64, boost::multiprecision::unsigned_magnitude, boost::multiprecision::unchecked, void > >
 
using u128 = boost::multiprecision::number< boost::multiprecision::cpp_int_backend< 128, 128, boost::multiprecision::unsigned_magnitude, boost::multiprecision::unchecked, void > >
 
using u256 = boost::multiprecision::number< boost::multiprecision::cpp_int_backend< 256, 256, boost::multiprecision::unsigned_magnitude, boost::multiprecision::unchecked, void > >
 
using s256 = boost::multiprecision::number< boost::multiprecision::cpp_int_backend< 256, 256, boost::multiprecision::signed_magnitude, boost::multiprecision::unchecked, void > >
 
using u160 = boost::multiprecision::number< boost::multiprecision::cpp_int_backend< 160, 160, boost::multiprecision::unsigned_magnitude, boost::multiprecision::unchecked, void > >
 
using s160 = boost::multiprecision::number< boost::multiprecision::cpp_int_backend< 160, 160, boost::multiprecision::signed_magnitude, boost::multiprecision::unchecked, void > >
 
using u512 = boost::multiprecision::number< boost::multiprecision::cpp_int_backend< 512, 512, boost::multiprecision::unsigned_magnitude, boost::multiprecision::unchecked, void > >
 
using s512 = boost::multiprecision::number< boost::multiprecision::cpp_int_backend< 512, 512, boost::multiprecision::signed_magnitude, boost::multiprecision::unchecked, void > >
 
using u256s = std::vector< u256 >
 
using u160s = std::vector< u160 >
 
using u256Set = std::set< u256 >
 
using u160Set = std::set< u160 >
 
using StringMap = std::map< std::string, std::string >
 
using BytesMap = std::map< bytes, bytes >
 
using u256Map = std::map< u256, u256 >
 
using HexMap = std::map< bytes, bytes >
 
using StringHashMap = std::unordered_map< std::string, std::string >
 
using u256HashMap = std::unordered_map< u256, u256 >
 
using strings = std::vector< std::string >
 
using errinfo_invalidSymbol = boost::error_info< struct tag_invalidSymbol, char >
 
using errinfo_wrongAddress = boost::error_info< struct tag_address, std::string >
 
using errinfo_required = boost::error_info< struct tag_required, bigint >
 
using errinfo_got = boost::error_info< struct tag_got, bigint >
 
using errinfo_min = boost::error_info< struct tag_min, bigint >
 
using errinfo_max = boost::error_info< struct tag_max, bigint >
 
using RequirementError = boost::tuple< errinfo_required, errinfo_got >
 
using RequirementErrorComment = boost::tuple< errinfo_required, errinfo_got, errinfo_comment >
 
using errinfo_hash256 = boost::error_info< struct tag_hash, h256 >
 
using errinfo_required_h256 = boost::error_info< struct tag_required_h256, h256 >
 
using errinfo_got_h256 = boost::error_info< struct tag_get_h256, h256 >
 
using Hash256RequirementError = boost::tuple< errinfo_required_h256, errinfo_got_h256 >
 
using errinfo_extraData = boost::error_info< struct tag_extraData, bytes >
 
using errinfo_externalFunction = boost::errinfo_api_function
 
using errinfo_interface = boost::error_info< struct tag_interface, std::string >
 
using errinfo_path = boost::error_info< struct tag_path, std::string >
 
using errinfo_nodeID = boost::error_info< struct tag_nodeID, h512 >
 
using h2048 = FixedHash< 256 >
 
using h1024 = FixedHash< 128 >
 
using h520 = FixedHash< 65 >
 
using h512 = FixedHash< 64 >
 
using h256 = FixedHash< 32 >
 
using h160 = FixedHash< 20 >
 
using h128 = FixedHash< 16 >
 
using h64 = FixedHash< 8 >
 
using h512s = std::vector< h512 >
 
using h256s = std::vector< h256 >
 
using h160s = std::vector< h160 >
 
using h256Set = std::set< h256 >
 
using h160Set = std::set< h160 >
 
using h256Hash = std::unordered_set< h256 >
 
using h160Hash = std::unordered_set< h160 >
 
using Mutex = std::mutex
 
using RecursiveMutex = std::recursive_mutex
 
using SharedMutex = boost::shared_mutex
 
using Guard = std::lock_guard< std::mutex >
 
using UniqueGuard = std::unique_lock< std::mutex >
 
using RecursiveGuard = std::lock_guard< std::recursive_mutex >
 
using ReadGuard = boost::shared_lock< boost::shared_mutex >
 
using UpgradableGuard = boost::upgrade_lock< boost::shared_mutex >
 
using UpgradeGuard = boost::upgrade_to_unique_lock< boost::shared_mutex >
 
using WriteGuard = boost::unique_lock< boost::shared_mutex >
 
using Logger = boost::log::sources::severity_channel_logger<>
 
using Secret = SecureFixedHash< 32 >
 
using Public = h512
 
using PublicCompressed = FixedHash< 33 >
 
using Signature = h520
 
using CompactSignature = h512
 
using Secrets = std::vector< Secret >
 A vector of secrets. More...
 

Enumerations

enum class  WhenError { DontThrow = 0 , Throw = 1 }
 
enum  Signedness { unsigned_only , signed_only , any }
 
enum class  OnFailed { InterpretRaw , Empty , Throw }
 
enum  Verbosity {
  VerbositySilent = -1 , VerbosityError = 0 , VerbosityWarning = 1 , VerbosityInfo = 2 ,
  VerbosityDebug = 3 , VerbosityTrace = 4
}
 

Functions

bool assertAux (bool _a, char const *_aStr, unsigned _line, char const *_file, char const *_func)
 
template<class A , class B >
bool assertEqualAux (A const &_a, B const &_b, char const *_aStr, char const *_bStr, unsigned _line, char const *_file, char const *_func)
 
template<class _ExceptionType >
void assertThrowAux (bool _condition, ::std::string const &_errorDescription, unsigned _line, char const *_file, char const *_function)
 
template<class _ExceptionType >
void assertThrowAux (void const *_pointer, ::std::string const &_errorDescription, unsigned _line, char const *_file, char const *_function)
 
std::string toBase64 (bytesConstRef _in)
 
std::string toBase64URLSafe (bytesConstRef _in)
 
bytes fromBase64 (std::string const &_in)
 
int64_t utcTime ()
 Get the current time in seconds since the epoch in UTC. More...
 
template<size_t n>
u256 exp10 ()
 
template<>
u256 exp10< 0 > ()
 
template<class Iterator >
std::string toHex (Iterator _it, Iterator _end, std::string const &_prefix)
 
template<class T >
std::string toHex (T const &_data)
 
template<class T >
std::string toHexPrefixed (T const &_data)
 
bytes fromHex (std::string const &_s, WhenError _throw=WhenError::DontThrow)
 
bool isHex (std::string const &_s) noexcept
 
template<class T >
static bool isHash (std::string const &_hash)
 
std::string asString (bytes const &_b)
 
std::string asString (bytesConstRef _b)
 
bytes asBytes (std::string const &_b)
 Converts a string to a byte array containing the string's (byte) data. More...
 
bytes asNibbles (bytesConstRef const &_s)
 
template<class T , class Out >
void toBigEndian (T _val, Out &o_out)
 
template<class T , class _In >
fromBigEndian (_In const &_bytes)
 
std::string toBigEndianString (u256 _val)
 Convenience functions for toBigEndian. More...
 
std::string toBigEndianString (u160 _val)
 
bytes toBigEndian (u256 _val)
 
bytes toBigEndian (u160 _val)
 
template<class T >
bytes toCompactBigEndian (T _val, unsigned _min=0)
 
bytes toCompactBigEndian (::byte _val, unsigned _min=0)
 
template<class T >
std::string toCompactBigEndianString (T _val, unsigned _min=0)
 
std::string toCompactHex (u256 _val, unsigned _min=0)
 
std::string toCompactHexPrefixed (u256 _val, unsigned _min=0)
 
std::string escaped (std::string const &_s, bool _all=true)
 
template<class T , class _U >
unsigned commonPrefix (T const &_t, _U const &_u)
 
template<class T >
unsigned bytesRequired (T _i)
 
template<class T >
void trimFront (T &_t, unsigned _elements)
 
template<class T , class _U >
void pushFront (T &_t, _U _e)
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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::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)
 
template<class T , class V >
bool contains (T const &_t, V const &_v)
 
template<class V >
bool contains (std::unordered_set< V > const &_set, V const &_v)
 
template<class K , class V >
bool contains (std::unordered_map< K, V > const &_map, K const &_k)
 
template<class V >
bool contains (std::set< V > const &_set, V const &_v)
 
template<typename N >
static constexpr std::enable_if_t<!std::is_enum_v< N >, bool > is_integer (Signedness sig)
 
template<typename N >
static constexpr std::enable_if_t< std::is_enum_v< N >, bool > is_integer (Signedness sig)
 
std::ostream & operator<< (std::ostream &_out, bytes const &_e)
 
template<class T >
std::ostream & operator<< (std::ostream &_out, std::vector< T > const &_e)
 
template<class T , std::size_t Z>
std::ostream & operator<< (std::ostream &_out, std::array< T, Z > const &_e)
 
template<class T , class U >
std::ostream & operator<< (std::ostream &_out, std::set< T, U > const &_e)
 
template<class T , class U >
std::ostream & operator<< (std::ostream &_out, std::unordered_set< T, U > const &_e)
 
template<class T >
std::string toString (std::chrono::time_point< T > const &_e, std::string const &_format="%F %T")
 
template<class T >
std::ostream & streamout (std::ostream &_out, std::vector< T > const &_e)
 
template<class T , std::size_t Z>
std::ostream & streamout (std::ostream &_out, std::array< T, Z > const &_e)
 
template<class T >
std::ostream & streamout (std::ostream &_out, std::set< T > const &_v)
 
template<class T >
std::ostream & operator<< (std::ostream &_out, std::set< T > const &_e)
 
template<class T >
std::ostream & streamout (std::ostream &_out, std::unordered_set< T > const &_v)
 
template<class T >
std::ostream & operator<< (std::ostream &_out, std::unordered_set< T > const &_e)
 
template<class _T >
std::string toString (_T const &_t)
 Converts arbitrary value to string representation using std::stringstream. More...
 
template<>
std::string toString< std::string > (std::string const &_s)
 
template<>
std::string toString< uint8_t > (uint8_t const &_u)
 
bytes jsToBytes (string const &_s, OnFailed _f)
 
std::string toJS (::byte _b)
 
template<unsigned S>
std::string toJS (FixedHash< S > const &_h)
 
template<unsigned N>
std::string toJS (boost::multiprecision::number< boost::multiprecision::cpp_int_backend< N, N, boost::multiprecision::unsigned_magnitude, boost::multiprecision::unchecked, void >> const &_n)
 
std::string toJS (bytes const &_n, std::size_t _padding=0)
 
template<unsigned T>
std::string toJS (SecureFixedHash< T > const &_i)
 
template<typename T >
std::string toJS (T const &_i)
 
bytes jsToBytes (std::string const &_s, OnFailed _f=OnFailed::Empty)
 
template<unsigned N>
FixedHash< N > jsToFixed (std::string const &_s)
 
template<unsigned N>
boost::multiprecision::number< boost::multiprecision::cpp_int_backend< N *8, N *8, boost::multiprecision::unsigned_magnitude, boost::multiprecision::unchecked, void > > jsToInt (std::string const &_s)
 
u256 jsToU256 (std::string const &_s)
 
uint64_t getUInt (const Json::Value &v)
 
 DEV_SIMPLE_EXCEPTION_RLP (BadCast)
 
 DEV_SIMPLE_EXCEPTION_RLP (BadRLP)
 
 DEV_SIMPLE_EXCEPTION_RLP (OversizeRLP)
 
 DEV_SIMPLE_EXCEPTION_RLP (UndersizeRLP)
 
 DEV_SIMPLE_EXCEPTION (BadHexCharacter)
 
 DEV_SIMPLE_EXCEPTION (NoNetworking)
 
 DEV_SIMPLE_EXCEPTION (NoUPnPDevice)
 
 DEV_SIMPLE_EXCEPTION (RootNotFound)
 
 DEV_SIMPLE_EXCEPTION (BadRoot)
 
 DEV_SIMPLE_EXCEPTION (FileError)
 
 DEV_SIMPLE_EXCEPTION (Overflow)
 
 DEV_SIMPLE_EXCEPTION (FailedInvariant)
 
 DEV_SIMPLE_EXCEPTION (ValueTooLarge)
 
 DEV_SIMPLE_EXCEPTION (UnknownField)
 
 DEV_SIMPLE_EXCEPTION (MissingField)
 
 DEV_SIMPLE_EXCEPTION (WrongFieldType)
 
 DEV_SIMPLE_EXCEPTION (InterfaceNotSupported)
 
 DEV_SIMPLE_EXCEPTION (ExternalFunctionFailure)
 
 DEV_SIMPLE_EXCEPTION (WaitTimeout)
 
template<unsigned N>
std::size_t hash_value (FixedHash< N > const &_value)
 Function for boost::hash. More...
 
template<unsigned N>
std::ostream & operator<< (std::ostream &_out, FixedHash< N > const &_h)
 Stream I/O for the FixedHash class. More...
 
template<unsigned N>
std::istream & operator>> (std::istream &_in, FixedHash< N > &o_h)
 
template<unsigned N>
std::ostream & operator<< (std::ostream &_out, SecureFixedHash< N > const &_h)
 Stream I/O for the SecureFixedHash class. More...
 
h160 right160 (h256 const &_t)
 
std::string toString (h256s const &_bs)
 
 BOOST_LOG_INLINE_GLOBAL_LOGGER_CTOR_ARGS (g_errorLogger, boost::log::sources::severity_channel_logger_mt<>,(boost::log::keywords::severity=VerbosityError)(boost::log::keywords::channel="error")) BOOST_LOG_INLINE_GLOBAL_LOGGER_CTOR_ARGS(g_warnLogger
 
Logger createLogger (int _severity, std::string const &_channel)
 
boost::log::formatting_ostream & operator<< (boost::log::formatting_ostream &_strm, bigint const &_value)
 
boost::log::formatting_ostream & operator<< (boost::log::formatting_ostream &_strm, u256 const &_value)
 
boost::log::formatting_ostream & operator<< (boost::log::formatting_ostream &_strm, u160 const &_value)
 
template<unsigned N>
boost::log::formatting_ostream & operator<< (boost::log::formatting_ostream &_strm, FixedHash< N > const &_value)
 
template<unsigned N>
boost::log::formatting_ostream & operator<< (boost::log::formatting_ostream &_strm, FixedHash< N > &_value)
 
boost::log::formatting_ostream & operator<< (boost::log::formatting_ostream &_strm, h160 const &_value)
 
boost::log::formatting_ostream & operator<< (boost::log::formatting_ostream &_strm, h256 const &_value)
 
boost::log::formatting_ostream & operator<< (boost::log::formatting_ostream &_strm, h512 const &_value)
 
boost::log::formatting_ostream & operator<< (boost::log::formatting_ostream &_strm, bytesConstRef _value)
 
template<class _T >
void rlpListAux (RLPStream &_out, _T _t)
 
template<class _T , class... _Ts>
void rlpListAux (RLPStream &_out, _T _t, _Ts... _ts)
 
template<class _T >
bytes rlp (_T _t)
 Export a single item in RLP format, returning a byte array. More...
 
bytes rlpList ()
 Export a list of items in RLP format, returning a byte array. More...
 
template<class... _Ts>
bytes rlpList (_Ts... _ts)
 
std::ostream & operator<< (std::ostream &_out, dev::RLP const &_d)
 Human readable version of RLP. More...
 
bool sha3 (bytesConstRef _input, bytesRef o_output) noexcept
 
h256 sha3 (bytesConstRef _input) noexcept
 Calculate SHA3-256 hash of the given input, returning as a 256-bit hash. More...
 
SecureFixedHash< 32 > sha3Secure (bytesConstRef _input) noexcept
 
h256 sha3 (bytes const &_input) noexcept
 Calculate SHA3-256 hash of the given input, returning as a 256-bit hash. More...
 
SecureFixedHash< 32 > sha3Secure (bytes const &_input) noexcept
 
h256 sha3 (std::string const &_input) noexcept
 
SecureFixedHash< 32 > sha3Secure (std::string const &_input) noexcept
 
h256 sha3 (h256 const &_input) noexcept
 Keccak hash variant optimized for hashing 256-bit hashes. More...
 
template<unsigned N>
h256 sha3 (FixedHash< N > const &_input) noexcept
 
template<unsigned N>
SecureFixedHash< 32 > sha3Secure (FixedHash< N > const &_input) noexcept
 
SecureFixedHash< 32 > sha3 (bytesSec const &_input) noexcept
 Fully secure variants are equivalent for sha3 and sha3Secure. More...
 
SecureFixedHash< 32 > sha3Secure (bytesSec const &_input) noexcept
 
template<unsigned N>
SecureFixedHash< 32 > sha3 (SecureFixedHash< N > const &_input) noexcept
 
template<unsigned N>
SecureFixedHash< 32 > sha3Secure (SecureFixedHash< N > const &_input) noexcept
 
std::string sha3 (std::string const &_input, bool _isNibbles)
 
void sha3mac (bytesConstRef _secret, bytesConstRef _plain, bytesRef _output)
 Calculate SHA3-256 MAC. More...
 
template<class _T >
vector_ref< _T const > ref (_T const &_t)
 
template<class _T >
vector_ref< _T > ref (_T &_t)
 
template<class _T >
vector_ref< _T const > ref (std::vector< _T > const &_t)
 
template<class _T >
vector_ref< _T > ref (std::vector< _T > &_t)
 
bytes aesDecrypt (bytesConstRef _cipher, std::string const &_password, unsigned _rounds=2000, bytesConstRef _salt=bytesConstRef())
 
h512 toCompact (const Signature &_s)
 
Public toPublic (Secret const &_secret)
 Convert a secret key into the public key equivalent. More...
 
Public toPublic (PublicCompressed const &_publicCompressed)
 Convert a compressed public key into the uncompressed equivalent. More...
 
PublicCompressed toPublicCompressed (Secret const &_secret)
 Convert a secret key into the public key in compressed format. More...
 
Address toAddress (Public const &_public)
 Convert a public key to address. More...
 
Address toAddress (Secret const &_secret)
 
void encrypt (Public const &_k, bytesConstRef _plain, bytes &o_cipher)
 Encrypts plain text using Public key. More...
 
bool decrypt (Secret const &_k, bytesConstRef _cipher, bytes &o_plaintext)
 Decrypts cipher using Secret key. More...
 
void encryptECIES (Public const &_k, bytesConstRef _plain, bytes &o_cipher)
 Encrypt payload using ECIES standard with AES128-CTR. More...
 
void encryptECIES (Public const &_k, bytesConstRef _sharedMacData, bytesConstRef _plain, bytes &o_cipher)
 
bool decryptECIES (Secret const &_k, bytesConstRef _cipher, bytes &o_plaintext)
 Decrypt payload using ECIES standard with AES128-CTR. More...
 
bool decryptECIES (Secret const &_k, bytesConstRef _sharedMacData, bytesConstRef _cipher, bytes &o_plaintext)
 
std::pair< bytes, h128encryptSymNoAuth (SecureFixedHash< 16 > const &_k, bytesConstRef _plain)
 Encrypts payload with random IV/ctr using AES128-CTR. More...
 
bytes encryptAES128CTR (bytesConstRef _k, h128 const &_iv, bytesConstRef _plain)
 Encrypts payload with specified IV/ctr using AES128-CTR. More...
 
bytesSec decryptAES128CTR (bytesConstRef _k, h128 const &_iv, bytesConstRef _cipher)
 Decrypts payload with specified IV/ctr using AES128-CTR. More...
 
bytes encryptSymNoAuth (SecureFixedHash< 16 > const &_k, h128 const &_iv, bytesConstRef _plain)
 Encrypts payload with specified IV/ctr using AES128-CTR. More...
 
bytes encryptSymNoAuth (SecureFixedHash< 32 > const &_k, h128 const &_iv, bytesConstRef _plain)
 
bytesSec decryptSymNoAuth (SecureFixedHash< 16 > const &_k, h128 const &_iv, bytesConstRef _cipher)
 Decrypts payload with specified IV/ctr using AES128-CTR. More...
 
bytesSec decryptSymNoAuth (SecureFixedHash< 32 > const &_k, h128 const &_iv, bytesConstRef _cipher)
 
Public recover (Signature const &_sig, h256 const &_hash)
 Recovers Public key from signed message hash. More...
 
Signature sign (Secret const &_k, h256 const &_hash)
 Returns siganture of message hash. More...
 
bool verify (Public const &_k, Signature const &_s, h256 const &_hash)
 Verify signature. More...
 
bool verify (PublicCompressed const &_key, h512 const &_signature, h256 const &_hash)
 

Variables

Address const ZeroAddress
 The zero address. More...
 
bytes const NullBytes
 
std::string const EmptyString
 
char const * Version
 
static const auto c_steadyClockMin = std::chrono::steady_clock::time_point::min()
 
static std::random_device s_fixedHashEngine
 
static const ::byte c_rlpMaxLengthBytes = 8
 
static const ::byte c_rlpDataImmLenStart = 0x80
 
static const ::byte c_rlpListStart = 0xc0
 
static const ::byte c_rlpDataImmLenCount = c_rlpListStart - c_rlpDataImmLenStart - c_rlpMaxLengthBytes
 
static const ::byte c_rlpDataIndLenZero = c_rlpDataImmLenStart + c_rlpDataImmLenCount - 1
 
static const ::byte c_rlpListImmLenCount = 256 - c_rlpListStart - c_rlpMaxLengthBytes
 
static const ::byte c_rlpListIndLenZero = c_rlpListStart + c_rlpListImmLenCount - 1
 
bytes RLPNull = rlp("")
 The empty string in RLP format. More...
 
bytes RLPEmptyList = rlpList()
 The empty list in RLP format. More...
 

Detailed Description

Adapted from code found on http://stackoverflow.com/questions/180947/base64-decode-snippet-in-c Originally by René Nyffenegger. DEVified by Gav Wood.

AES todo: use openssl

Ethereum-specific data structures & algorithms.

CryptoPP headers and primitive helper methods

Typedef Documentation

◆ Address

using dev::Address = typedef h160

An Ethereum address: 20 bytes. @NOTE This is not endian-specific; it's just a bunch of bytes.

◆ Addresses

using dev::Addresses = typedef h160s

A vector of Ethereum addresses.

◆ AddressSet

using dev::AddressSet = typedef std::unordered_set<h160>

A hash set of Ethereum addresses.

◆ bigint

using dev::bigint = typedef boost::multiprecision::number<boost::multiprecision::cpp_int_backend<> >

◆ bytes

using dev::bytes = typedef std::vector<::byte>

◆ bytesConstRef

using dev::bytesConstRef = typedef vector_ref<::byte const>

◆ BytesMap

using dev::BytesMap = typedef std::map<bytes, bytes>

◆ bytesRef

using dev::bytesRef = typedef vector_ref<::byte>

◆ bytesSec

using dev::bytesSec = typedef secure_vector<::byte>

◆ CompactSignature

using dev::CompactSignature = typedef h512

A compact signature: 65 bytes: r: [0, 32), vs: [32, 64). @NOTE This is not endian-specific; it's just a bunch of bytes. https://eips.ethereum.org/EIPS/eip-2098

◆ errinfo_comment

typedef boost::error_info< struct tag_comment, std::string > dev::errinfo_comment

◆ errinfo_externalFunction

using dev::errinfo_externalFunction = typedef boost::errinfo_api_function

◆ errinfo_extraData

using dev::errinfo_extraData = typedef boost::error_info<struct tag_extraData, bytes>

◆ errinfo_got

using dev::errinfo_got = typedef boost::error_info<struct tag_got, bigint>

◆ errinfo_got_h256

using dev::errinfo_got_h256 = typedef boost::error_info<struct tag_get_h256, h256>

◆ errinfo_hash256

using dev::errinfo_hash256 = typedef boost::error_info<struct tag_hash, h256>

◆ errinfo_interface

using dev::errinfo_interface = typedef boost::error_info<struct tag_interface, std::string>

◆ errinfo_invalidSymbol

using dev::errinfo_invalidSymbol = typedef boost::error_info<struct tag_invalidSymbol, char>

◆ errinfo_max

using dev::errinfo_max = typedef boost::error_info<struct tag_max, bigint>

◆ errinfo_min

using dev::errinfo_min = typedef boost::error_info<struct tag_min, bigint>

◆ errinfo_nodeID

using dev::errinfo_nodeID = typedef boost::error_info<struct tag_nodeID, h512>

◆ errinfo_path

using dev::errinfo_path = typedef boost::error_info<struct tag_path, std::string>

◆ errinfo_required

using dev::errinfo_required = typedef boost::error_info<struct tag_required, bigint>

◆ errinfo_required_h256

using dev::errinfo_required_h256 = typedef boost::error_info<struct tag_required_h256, h256>

◆ errinfo_wrongAddress

using dev::errinfo_wrongAddress = typedef boost::error_info<struct tag_address, std::string>

◆ Guard

using dev::Guard = typedef std::lock_guard<std::mutex>

◆ h1024

using dev::h1024 = typedef FixedHash<128>

◆ h128

using dev::h128 = typedef FixedHash<16>

◆ h160

using dev::h160 = typedef FixedHash<20>

◆ h160Hash

using dev::h160Hash = typedef std::unordered_set<h160>

◆ h160s

using dev::h160s = typedef std::vector<h160>

◆ h160Set

using dev::h160Set = typedef std::set<h160>

◆ h2048

using dev::h2048 = typedef FixedHash<256>

◆ h256

using dev::h256 = typedef FixedHash<32>

◆ h256Hash

using dev::h256Hash = typedef std::unordered_set<h256>

◆ h256s

using dev::h256s = typedef std::vector<h256>

◆ h256Set

using dev::h256Set = typedef std::set<h256>

◆ h512

using dev::h512 = typedef FixedHash<64>

◆ h512s

using dev::h512s = typedef std::vector<h512>

◆ h520

using dev::h520 = typedef FixedHash<65>

◆ h64

using dev::h64 = typedef FixedHash<8>

◆ Hash256RequirementError

◆ HexMap

using dev::HexMap = typedef std::map<bytes, bytes>

◆ Logger

using dev::Logger = typedef boost::log::sources::severity_channel_logger<>

◆ Mutex

using dev::Mutex = typedef std::mutex

◆ Public

using dev::Public = typedef h512

A public key: 64 bytes. @NOTE This is not endian-specific; it's just a bunch of bytes.

◆ PublicCompressed

using dev::PublicCompressed = typedef FixedHash<33>

A public key in compressed format: 33 bytes. @NOTE This is not endian-specific; it's just a bunch of bytes.

◆ ReadGuard

using dev::ReadGuard = typedef boost::shared_lock<boost::shared_mutex>

◆ RecursiveGuard

using dev::RecursiveGuard = typedef std::lock_guard<std::recursive_mutex>

◆ RecursiveMutex

using dev::RecursiveMutex = typedef std::recursive_mutex

◆ RequirementError

using dev::RequirementError = typedef boost::tuple<errinfo_required, errinfo_got>

◆ RequirementErrorComment

◆ s160

using dev::s160 = typedef boost::multiprecision::number<boost::multiprecision::cpp_int_backend< 160, 160, boost::multiprecision::signed_magnitude, boost::multiprecision::unchecked, void> >

◆ s256

using dev::s256 = typedef boost::multiprecision::number<boost::multiprecision::cpp_int_backend< 256, 256, boost::multiprecision::signed_magnitude, boost::multiprecision::unchecked, void> >

◆ s512

using dev::s512 = typedef boost::multiprecision::number<boost::multiprecision::cpp_int_backend< 512, 512, boost::multiprecision::signed_magnitude, boost::multiprecision::unchecked, void> >

◆ Secret

using dev::Secret = typedef SecureFixedHash<32>

◆ Secrets

using dev::Secrets = typedef std::vector<Secret>

A vector of secrets.

◆ SharedMutex

using dev::SharedMutex = typedef boost::shared_mutex

◆ Signature

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.

◆ StringHashMap

using dev::StringHashMap = typedef std::unordered_map<std::string, std::string>

◆ StringMap

using dev::StringMap = typedef std::map<std::string, std::string>

◆ strings

using dev::strings = typedef std::vector<std::string>

◆ u128

using dev::u128 = typedef boost::multiprecision::number<boost::multiprecision::cpp_int_backend< 128, 128, boost::multiprecision::unsigned_magnitude, boost::multiprecision::unchecked, void> >

◆ u160

using dev::u160 = typedef boost::multiprecision::number<boost::multiprecision::cpp_int_backend< 160, 160, boost::multiprecision::unsigned_magnitude, boost::multiprecision::unchecked, void> >

◆ u160s

using dev::u160s = typedef std::vector<u160>

◆ u160Set

using dev::u160Set = typedef std::set<u160>

◆ u256

using dev::u256 = typedef boost::multiprecision::number<boost::multiprecision::cpp_int_backend< 256, 256, boost::multiprecision::unsigned_magnitude, boost::multiprecision::unchecked, void> >

◆ u256HashMap

using dev::u256HashMap = typedef std::unordered_map<u256, u256>

◆ u256Map

using dev::u256Map = typedef std::map<u256, u256>

◆ u256s

using dev::u256s = typedef std::vector<u256>

◆ u256Set

using dev::u256Set = typedef std::set<u256>

◆ u512

using dev::u512 = typedef boost::multiprecision::number<boost::multiprecision::cpp_int_backend< 512, 512, boost::multiprecision::unsigned_magnitude, boost::multiprecision::unchecked, void> >

◆ u64

using dev::u64 = typedef boost::multiprecision::number<boost::multiprecision::cpp_int_backend< 64, 64, boost::multiprecision::unsigned_magnitude, boost::multiprecision::unchecked, void> >

◆ UniqueGuard

using dev::UniqueGuard = typedef std::unique_lock<std::mutex>

◆ UpgradableGuard

using dev::UpgradableGuard = typedef boost::upgrade_lock<boost::shared_mutex>

◆ UpgradeGuard

using dev::UpgradeGuard = typedef boost::upgrade_to_unique_lock<boost::shared_mutex>

◆ WriteGuard

using dev::WriteGuard = typedef boost::unique_lock<boost::shared_mutex>

Enumeration Type Documentation

◆ OnFailed

enum dev::OnFailed
strong
Enumerator
InterpretRaw 
Empty 
Throw 

◆ Signedness

Enumerator
unsigned_only 
signed_only 
any 

◆ Verbosity

Enumerator
VerbositySilent 
VerbosityError 
VerbosityWarning 
VerbosityInfo 
VerbosityDebug 
VerbosityTrace 

◆ WhenError

enum dev::WhenError
strong
Enumerator
DontThrow 
Throw 

Function Documentation

◆ aesDecrypt()

bytes dev::aesDecrypt ( bytesConstRef  _cipher,
std::string const &  _password,
unsigned  _rounds = 2000,
bytesConstRef  _salt = bytesConstRef() 
)

◆ asBytes()

bytes dev::asBytes ( std::string const &  _b)
inline

Converts a string to a byte array containing the string's (byte) data.

◆ asNibbles()

bytes dev::asNibbles ( bytesConstRef const &  _s)

◆ assertAux()

bool dev::assertAux ( bool  _a,
char const *  _aStr,
unsigned  _line,
char const *  _file,
char const *  _func 
)
inline

◆ assertEqualAux()

template<class A , class B >
bool dev::assertEqualAux ( A const &  _a,
B const &  _b,
char const *  _aStr,
char const *  _bStr,
unsigned  _line,
char const *  _file,
char const *  _func 
)
inline

◆ assertThrowAux() [1/2]

template<class _ExceptionType >
void dev::assertThrowAux ( bool  _condition,
::std::string const &  _errorDescription,
unsigned  _line,
char const *  _file,
char const *  _function 
)
inline

◆ assertThrowAux() [2/2]

template<class _ExceptionType >
void dev::assertThrowAux ( void const *  _pointer,
::std::string const &  _errorDescription,
unsigned  _line,
char const *  _file,
char const *  _function 
)
inline

◆ asString() [1/2]

std::string dev::asString ( bytes const &  _b)
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.

◆ asString() [2/2]

std::string dev::asString ( bytesConstRef  _b)
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.

◆ BOOST_LOG_INLINE_GLOBAL_LOGGER_CTOR_ARGS()

dev::BOOST_LOG_INLINE_GLOBAL_LOGGER_CTOR_ARGS ( g_errorLogger  ,
boost::log::sources::severity_channel_logger_mt<>  ,
(boost::log::keywords::severity=VerbosityError)(boost::log::keywords::channel="error")   
)

◆ bytesRequired()

template<class T >
unsigned dev::bytesRequired ( _i)
inline

Determine bytes required to encode the given integer value.

Returns
0 if _i is zero.

◆ commonPrefix()

template<class T , class _U >
unsigned dev::commonPrefix ( T const &  _t,
_U const &  _u 
)

◆ contains() [1/4]

template<class V >
bool dev::contains ( std::set< V > const &  _set,
V const &  _v 
)

◆ contains() [2/4]

template<class K , class V >
bool dev::contains ( std::unordered_map< K, V > const &  _map,
K const &  _k 
)

◆ contains() [3/4]

template<class V >
bool dev::contains ( std::unordered_set< V > const &  _set,
V const &  _v 
)

◆ contains() [4/4]

template<class T , class V >
bool dev::contains ( T const &  _t,
V const &  _v 
)

◆ createLogger()

Logger dev::createLogger ( int  _severity,
std::string const &  _channel 
)
inline

◆ decrypt()

bool dev::decrypt ( Secret const &  _k,
bytesConstRef  _cipher,
bytes o_plaintext 
)

Decrypts cipher using Secret key.

◆ decryptAES128CTR()

bytesSec dev::decryptAES128CTR ( bytesConstRef  _k,
h128 const &  _iv,
bytesConstRef  _cipher 
)

Decrypts payload with specified IV/ctr using AES128-CTR.

◆ decryptECIES() [1/2]

bool dev::decryptECIES ( Secret const &  _k,
bytesConstRef  _cipher,
bytes o_plaintext 
)

Decrypt payload using ECIES standard with AES128-CTR.

◆ decryptECIES() [2/2]

bool dev::decryptECIES ( Secret const &  _k,
bytesConstRef  _sharedMacData,
bytesConstRef  _cipher,
bytes o_plaintext 
)

Decrypt payload using ECIES standard with AES128-CTR. _sharedMacData is shared authenticated data.

◆ decryptSymNoAuth() [1/2]

bytesSec dev::decryptSymNoAuth ( SecureFixedHash< 16 > const &  _k,
h128 const &  _iv,
bytesConstRef  _cipher 
)
inline

Decrypts payload with specified IV/ctr using AES128-CTR.

◆ decryptSymNoAuth() [2/2]

bytesSec dev::decryptSymNoAuth ( SecureFixedHash< 32 > const &  _k,
h128 const &  _iv,
bytesConstRef  _cipher 
)
inline

◆ DEV_SIMPLE_EXCEPTION() [1/15]

dev::DEV_SIMPLE_EXCEPTION ( BadHexCharacter  )

◆ DEV_SIMPLE_EXCEPTION() [2/15]

dev::DEV_SIMPLE_EXCEPTION ( BadRoot  )

◆ DEV_SIMPLE_EXCEPTION() [3/15]

dev::DEV_SIMPLE_EXCEPTION ( ExternalFunctionFailure  )

◆ DEV_SIMPLE_EXCEPTION() [4/15]

dev::DEV_SIMPLE_EXCEPTION ( FailedInvariant  )

◆ DEV_SIMPLE_EXCEPTION() [5/15]

dev::DEV_SIMPLE_EXCEPTION ( FileError  )

◆ DEV_SIMPLE_EXCEPTION() [6/15]

dev::DEV_SIMPLE_EXCEPTION ( InterfaceNotSupported  )

◆ DEV_SIMPLE_EXCEPTION() [7/15]

dev::DEV_SIMPLE_EXCEPTION ( MissingField  )

◆ DEV_SIMPLE_EXCEPTION() [8/15]

dev::DEV_SIMPLE_EXCEPTION ( NoNetworking  )

◆ DEV_SIMPLE_EXCEPTION() [9/15]

dev::DEV_SIMPLE_EXCEPTION ( NoUPnPDevice  )

◆ DEV_SIMPLE_EXCEPTION() [10/15]

dev::DEV_SIMPLE_EXCEPTION ( Overflow  )

◆ DEV_SIMPLE_EXCEPTION() [11/15]

dev::DEV_SIMPLE_EXCEPTION ( RootNotFound  )

◆ DEV_SIMPLE_EXCEPTION() [12/15]

dev::DEV_SIMPLE_EXCEPTION ( UnknownField  )

◆ DEV_SIMPLE_EXCEPTION() [13/15]

dev::DEV_SIMPLE_EXCEPTION ( ValueTooLarge  )

◆ DEV_SIMPLE_EXCEPTION() [14/15]

dev::DEV_SIMPLE_EXCEPTION ( WaitTimeout  )

◆ DEV_SIMPLE_EXCEPTION() [15/15]

dev::DEV_SIMPLE_EXCEPTION ( WrongFieldType  )

◆ DEV_SIMPLE_EXCEPTION_RLP() [1/4]

dev::DEV_SIMPLE_EXCEPTION_RLP ( BadCast  )

◆ DEV_SIMPLE_EXCEPTION_RLP() [2/4]

dev::DEV_SIMPLE_EXCEPTION_RLP ( BadRLP  )

◆ DEV_SIMPLE_EXCEPTION_RLP() [3/4]

dev::DEV_SIMPLE_EXCEPTION_RLP ( OversizeRLP  )

◆ DEV_SIMPLE_EXCEPTION_RLP() [4/4]

dev::DEV_SIMPLE_EXCEPTION_RLP ( UndersizeRLP  )

◆ encrypt()

void dev::encrypt ( Public const &  _k,
bytesConstRef  _plain,
bytes o_cipher 
)

Encrypts plain text using Public key.

◆ encryptAES128CTR()

bytes dev::encryptAES128CTR ( bytesConstRef  _k,
h128 const &  _iv,
bytesConstRef  _plain 
)

Encrypts payload with specified IV/ctr using AES128-CTR.

◆ encryptECIES() [1/2]

void dev::encryptECIES ( Public const &  _k,
bytesConstRef  _plain,
bytes o_cipher 
)

Encrypt payload using ECIES standard with AES128-CTR.

◆ encryptECIES() [2/2]

void dev::encryptECIES ( Public const &  _k,
bytesConstRef  _sharedMacData,
bytesConstRef  _plain,
bytes o_cipher 
)

Encrypt payload using ECIES standard with AES128-CTR. _sharedMacData is shared authenticated data.

◆ encryptSymNoAuth() [1/3]

std::pair< bytes, h128 > dev::encryptSymNoAuth ( SecureFixedHash< 16 > const &  _k,
bytesConstRef  _plain 
)

Encrypts payload with random IV/ctr using AES128-CTR.

◆ encryptSymNoAuth() [2/3]

bytes dev::encryptSymNoAuth ( SecureFixedHash< 16 > const &  _k,
h128 const &  _iv,
bytesConstRef  _plain 
)
inline

Encrypts payload with specified IV/ctr using AES128-CTR.

◆ encryptSymNoAuth() [3/3]

bytes dev::encryptSymNoAuth ( SecureFixedHash< 32 > const &  _k,
h128 const &  _iv,
bytesConstRef  _plain 
)
inline

◆ escaped()

std::string dev::escaped ( std::string const &  _s,
bool  _all = true 
)

Escapes a string into the C-string representation. _all if true will escape all characters, not just the unprintable ones.

◆ exp10()

template<size_t n>
u256 dev::exp10 ( )
inline

◆ exp10< 0 >()

template<>
u256 dev::exp10< 0 > ( )
inline

◆ fromBase64()

bytes dev::fromBase64 ( std::string const &  _in)

◆ fromBigEndian()

template<class T , class _In >
T dev::fromBigEndian ( _In const &  _bytes)
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.

◆ fromHex()

bytes dev::fromHex ( std::string const &  _s,
WhenError  _throw = WhenError::DontThrow 
)

◆ getUInt()

uint64_t dev::getUInt ( const Json::Value &  v)
inline

◆ hash_value()

template<unsigned N>
std::size_t dev::hash_value ( FixedHash< N > const &  _value)
inline

Function for boost::hash.

◆ is_integer() [1/2]

template<typename N >
static constexpr std::enable_if_t<!std::is_enum_v<N>, bool> dev::is_integer ( Signedness  sig)
staticconstexpr

◆ is_integer() [2/2]

template<typename N >
static constexpr std::enable_if_t<std::is_enum_v<N>, bool> dev::is_integer ( Signedness  sig)
staticconstexpr

◆ isHash()

template<class T >
static bool dev::isHash ( std::string const &  _hash)
static
Returns
true if _hash is a hash conforming to FixedHash type T.

◆ isHex()

bool dev::isHex ( std::string const &  _s)
noexcept
Returns
true if _s is a hex string.

◆ jsToBytes() [1/2]

bytes dev::jsToBytes ( std::string const &  _s,
OnFailed  _f = OnFailed::Empty 
)

Convert string to byte array. Input parameter is hex, optionally prefixed by "0x". Returns empty array if invalid input.

◆ jsToBytes() [2/2]

bytes dev::jsToBytes ( string const &  _s,
OnFailed  _f 
)

◆ jsToFixed()

template<unsigned N>
FixedHash<N> dev::jsToFixed ( std::string const &  _s)

◆ jsToInt()

template<unsigned N>
uint64_t dev::jsToInt ( std::string const &  _s)
inline

◆ jsToU256()

u256 dev::jsToU256 ( std::string const &  _s)
inline

◆ keysOf() [1/2]

template<class T , class U >
std::vector<T> dev::keysOf ( std::map< T, U > const &  _m)

◆ keysOf() [2/2]

template<class T , class U >
std::vector<T> dev::keysOf ( std::unordered_map< T, U > const &  _m)

◆ operator+() [1/3]

template<class T , class U >
std::set<T> dev::operator+ ( std::set< T >  _a,
U const &  _b 
)

Insert the contents of a container into a set.

◆ operator+() [2/3]

template<class T , class U >
std::unordered_set<T> dev::operator+ ( std::unordered_set< T >  _a,
U const &  _b 
)

Insert the contents of a container into an unordered_set.

◆ operator+() [3/3]

template<class T , class U >
std::vector<T> dev::operator+ ( std::vector< T >  _a,
U const &  _b 
)

Concatenate the contents of a container onto a vector.

◆ operator+=() [1/3]

template<class T , class U >
std::set<T>& dev::operator+= ( std::set< T > &  _a,
U const &  _b 
)

Insert the contents of a container into a set.

◆ operator+=() [2/3]

template<class T , class U >
std::unordered_set<T>& dev::operator+= ( std::unordered_set< T > &  _a,
U const &  _b 
)

Insert the contents of a container into an unordered_set.

◆ operator+=() [3/3]

template<class T , class U >
std::vector<T>& dev::operator+= ( std::vector< T > &  _a,
U const &  _b 
)
inline

Concatenate the contents of a container onto a vector.

◆ operator<<() [1/19]

boost::log::formatting_ostream& dev::operator<< ( boost::log::formatting_ostream &  _strm,
bigint const &  _value 
)
inline

◆ operator<<() [2/19]

boost::log::formatting_ostream& dev::operator<< ( boost::log::formatting_ostream &  _strm,
bytesConstRef  _value 
)
inline

◆ operator<<() [3/19]

template<unsigned N>
boost::log::formatting_ostream& dev::operator<< ( boost::log::formatting_ostream &  _strm,
FixedHash< N > &  _value 
)
inline

◆ operator<<() [4/19]

template<unsigned N>
boost::log::formatting_ostream& dev::operator<< ( boost::log::formatting_ostream &  _strm,
FixedHash< N > const &  _value 
)
inline

◆ operator<<() [5/19]

boost::log::formatting_ostream& dev::operator<< ( boost::log::formatting_ostream &  _strm,
h160 const &  _value 
)
inline

◆ operator<<() [6/19]

boost::log::formatting_ostream& dev::operator<< ( boost::log::formatting_ostream &  _strm,
h256 const &  _value 
)
inline

◆ operator<<() [7/19]

boost::log::formatting_ostream& dev::operator<< ( boost::log::formatting_ostream &  _strm,
h512 const &  _value 
)
inline

◆ operator<<() [8/19]

boost::log::formatting_ostream& dev::operator<< ( boost::log::formatting_ostream &  _strm,
u160 const &  _value 
)
inline

◆ operator<<() [9/19]

boost::log::formatting_ostream& dev::operator<< ( boost::log::formatting_ostream &  _strm,
u256 const &  _value 
)
inline

◆ operator<<() [10/19]

std::ostream& dev::operator<< ( std::ostream &  _out,
bytes const &  _e 
)
inline

◆ operator<<() [11/19]

std::ostream & dev::operator<< ( std::ostream &  _out,
dev::RLP const &  _d 
)

Human readable version of RLP.

◆ operator<<() [12/19]

template<unsigned N>
std::ostream& dev::operator<< ( std::ostream &  _out,
FixedHash< N > const &  _h 
)
inline

Stream I/O for the FixedHash class.

◆ operator<<() [13/19]

template<unsigned N>
std::ostream& dev::operator<< ( std::ostream &  _out,
SecureFixedHash< N > const &  _h 
)
inline

Stream I/O for the SecureFixedHash class.

◆ operator<<() [14/19]

template<class T , std::size_t Z>
std::ostream & dev::operator<< ( std::ostream &  _out,
std::array< T, Z > const &  _e 
)
inline

◆ operator<<() [15/19]

template<class T >
std::ostream& dev::operator<< ( std::ostream &  _out,
std::set< T > const &  _e 
)
inline

◆ operator<<() [16/19]

template<class T , class U >
std::ostream& dev::operator<< ( std::ostream &  _out,
std::set< T, U > const &  _e 
)
inline

◆ operator<<() [17/19]

template<class T >
std::ostream& dev::operator<< ( std::ostream &  _out,
std::unordered_set< T > const &  _e 
)
inline

◆ operator<<() [18/19]

template<class T , class U >
std::ostream& dev::operator<< ( std::ostream &  _out,
std::unordered_set< T, U > const &  _e 
)
inline

◆ operator<<() [19/19]

template<class T >
std::ostream & dev::operator<< ( std::ostream &  _out,
std::vector< T > const &  _e 
)
inline

◆ operator>>()

template<unsigned N>
std::istream& dev::operator>> ( std::istream &  _in,
FixedHash< N > &  o_h 
)
inline

◆ pushFront()

template<class T , class _U >
void dev::pushFront ( T &  _t,
_U  _e 
)

Pushes an element on to the front of a collection. Only works for POD element types.

◆ recover()

Public dev::recover ( Signature const &  _sig,
h256 const &  _hash 
)

Recovers Public key from signed message hash.

◆ ref() [1/4]

template<class _T >
vector_ref<_T> dev::ref ( _T &  _t)

◆ ref() [2/4]

template<class _T >
vector_ref<_T const> dev::ref ( _T const &  _t)

◆ ref() [3/4]

template<class _T >
vector_ref<_T> dev::ref ( std::vector< _T > &  _t)

◆ ref() [4/4]

template<class _T >
vector_ref<_T const> dev::ref ( std::vector< _T > const &  _t)

◆ right160()

h160 dev::right160 ( h256 const &  _t)
inline

Convert the given value into h160 (160-bit unsigned integer) using the right 20 bytes.

◆ rlp()

template<class _T >
bytes dev::rlp ( _T  _t)

Export a single item in RLP format, returning a byte array.

◆ rlpList() [1/2]

bytes dev::rlpList ( )
inline

Export a list of items in RLP format, returning a byte array.

◆ rlpList() [2/2]

template<class... _Ts>
bytes dev::rlpList ( _Ts...  _ts)

◆ rlpListAux() [1/2]

template<class _T >
void dev::rlpListAux ( RLPStream _out,
_T  _t 
)

◆ rlpListAux() [2/2]

template<class _T , class... _Ts>
void dev::rlpListAux ( RLPStream _out,
_T  _t,
_Ts...  _ts 
)

◆ sha3() [1/9]

h256 dev::sha3 ( bytes const &  _input)
inlinenoexcept

Calculate SHA3-256 hash of the given input, returning as a 256-bit hash.

◆ sha3() [2/9]

h256 dev::sha3 ( bytesConstRef  _input)
inlinenoexcept

Calculate SHA3-256 hash of the given input, returning as a 256-bit hash.

◆ sha3() [3/9]

bool dev::sha3 ( bytesConstRef  _input,
bytesRef  o_output 
)
noexcept

Calculate SHA3-256 hash of the given input and load it into the given output.

Returns
false if o_output.size() != 32.

◆ sha3() [4/9]

SecureFixedHash<32> dev::sha3 ( bytesSec const &  _input)
inlinenoexcept

Fully secure variants are equivalent for sha3 and sha3Secure.

◆ sha3() [5/9]

template<unsigned N>
h256 dev::sha3 ( FixedHash< N > const &  _input)
inlinenoexcept

Calculate SHA3-256 hash of the given input (presented as a FixedHash), returns a 256-bit hash.

◆ sha3() [6/9]

h256 dev::sha3 ( h256 const &  _input)
inlinenoexcept

Keccak hash variant optimized for hashing 256-bit hashes.

◆ sha3() [7/9]

template<unsigned N>
SecureFixedHash<32> dev::sha3 ( SecureFixedHash< N > const &  _input)
inlinenoexcept

◆ sha3() [8/9]

h256 dev::sha3 ( std::string const &  _input)
inlinenoexcept

Calculate SHA3-256 hash of the given input (presented as a binary-filled string), returning as a 256-bit hash.

◆ sha3() [9/9]

std::string dev::sha3 ( std::string const &  _input,
bool  _isNibbles 
)
inline

Calculate SHA3-256 hash of the given input, possibly interpreting it as nibbles, and return the hash as a string filled with binary data.

◆ sha3mac()

void dev::sha3mac ( bytesConstRef  _secret,
bytesConstRef  _plain,
bytesRef  _output 
)
inline

Calculate SHA3-256 MAC.

◆ sha3Secure() [1/6]

SecureFixedHash<32> dev::sha3Secure ( bytes const &  _input)
inlinenoexcept

◆ sha3Secure() [2/6]

SecureFixedHash<32> dev::sha3Secure ( bytesConstRef  _input)
inlinenoexcept

◆ sha3Secure() [3/6]

SecureFixedHash<32> dev::sha3Secure ( bytesSec const &  _input)
inlinenoexcept

◆ sha3Secure() [4/6]

template<unsigned N>
SecureFixedHash<32> dev::sha3Secure ( FixedHash< N > const &  _input)
inlinenoexcept

◆ sha3Secure() [5/6]

template<unsigned N>
SecureFixedHash<32> dev::sha3Secure ( SecureFixedHash< N > const &  _input)
inlinenoexcept

◆ sha3Secure() [6/6]

SecureFixedHash<32> dev::sha3Secure ( std::string const &  _input)
inlinenoexcept

◆ sign()

Signature dev::sign ( Secret const &  _k,
h256 const &  _hash 
)

Returns siganture of message hash.

◆ streamout() [1/4]

template<class T , std::size_t Z>
std::ostream& dev::streamout ( std::ostream &  _out,
std::array< T, Z > const &  _e 
)
inline

◆ streamout() [2/4]

template<class T >
std::ostream& dev::streamout ( std::ostream &  _out,
std::set< T > const &  _v 
)

◆ streamout() [3/4]

template<class T >
std::ostream& dev::streamout ( std::ostream &  _out,
std::unordered_set< T > const &  _v 
)

◆ streamout() [4/4]

template<class T >
std::ostream& dev::streamout ( std::ostream &  _out,
std::vector< T > const &  _e 
)
inline

◆ toAddress() [1/2]

Address dev::toAddress ( Public const &  _public)

Convert a public key to address.

◆ toAddress() [2/2]

Address dev::toAddress ( Secret const &  _secret)

Convert a secret key into address of public key equivalent.

Returns
0 if it's not a valid secret key.

◆ toBase64()

string dev::toBase64 ( bytesConstRef  _in)

◆ toBase64URLSafe()

string dev::toBase64URLSafe ( bytesConstRef  _in)

◆ toBigEndian() [1/3]

template<class T , class Out >
void dev::toBigEndian ( _val,
Out &  o_out 
)
inline

Converts a templated integer value to the big-endian byte-stream represented on a templated collection. The size of the collection object will be unchanged. If it is too small, it will not represent the value properly, if too big then the additional elements will be zeroed out. Out will typically be either std::string or bytes. T will typically by unsigned, u160, u256 or bigint.

◆ toBigEndian() [2/3]

bytes dev::toBigEndian ( u160  _val)
inline

◆ toBigEndian() [3/3]

bytes dev::toBigEndian ( u256  _val)
inline

◆ toBigEndianString() [1/2]

std::string dev::toBigEndianString ( u160  _val)
inline

◆ toBigEndianString() [2/2]

std::string dev::toBigEndianString ( u256  _val)
inline

Convenience functions for toBigEndian.

◆ toCompact()

h512 dev::toCompact ( const Signature _s)

Convert signature to compact form. https://eips.ethereum.org/EIPS/eip-2098

◆ toCompactBigEndian() [1/2]

bytes dev::toCompactBigEndian ( ::byte  _val,
unsigned  _min = 0 
)
inline

◆ toCompactBigEndian() [2/2]

template<class T >
bytes dev::toCompactBigEndian ( _val,
unsigned  _min = 0 
)
inline

Convenience function for toBigEndian.

Returns
a byte array just big enough to represent _val.

◆ toCompactBigEndianString()

template<class T >
std::string dev::toCompactBigEndianString ( _val,
unsigned  _min = 0 
)
inline

Convenience function for toBigEndian.

Returns
a string just big enough to represent _val.

◆ toCompactHex()

std::string dev::toCompactHex ( u256  _val,
unsigned  _min = 0 
)
inline

◆ toCompactHexPrefixed()

std::string dev::toCompactHexPrefixed ( u256  _val,
unsigned  _min = 0 
)
inline

◆ toHex() [1/2]

template<class Iterator >
std::string dev::toHex ( Iterator  _it,
Iterator  _end,
std::string const &  _prefix 
)

◆ toHex() [2/2]

template<class T >
std::string dev::toHex ( T const &  _data)

◆ toHexPrefixed()

template<class T >
std::string dev::toHexPrefixed ( T const &  _data)

◆ toJS() [1/6]

std::string dev::toJS ( ::byte  _b)
inline

◆ toJS() [2/6]

template<unsigned N>
std::string dev::toJS ( boost::multiprecision::number< boost::multiprecision::cpp_int_backend< N, N, boost::multiprecision::unsigned_magnitude, boost::multiprecision::unchecked, void >> const &  _n)

◆ toJS() [3/6]

std::string dev::toJS ( bytes const &  _n,
std::size_t  _padding = 0 
)
inline

◆ toJS() [4/6]

template<unsigned S>
std::string dev::toJS ( FixedHash< S > const &  _h)

◆ toJS() [5/6]

template<unsigned T>
std::string dev::toJS ( SecureFixedHash< T > const &  _i)

◆ toJS() [6/6]

template<typename T >
std::string dev::toJS ( T const &  _i)

◆ toPublic() [1/2]

Public dev::toPublic ( PublicCompressed const &  _publicCompressed)

Convert a compressed public key into the uncompressed equivalent.

◆ toPublic() [2/2]

Public dev::toPublic ( Secret const &  _secret)

Convert a secret key into the public key equivalent.

◆ toPublicCompressed()

PublicCompressed dev::toPublicCompressed ( Secret const &  _secret)

Convert a secret key into the public key in compressed format.

◆ toString() [1/3]

template<class _T >
std::string dev::toString ( _T const &  _t)
inline

Converts arbitrary value to string representation using std::stringstream.

◆ toString() [2/3]

std::string dev::toString ( h256s const &  _bs)
inline

◆ toString() [3/3]

template<class T >
std::string dev::toString ( std::chrono::time_point< T > const &  _e,
std::string const &  _format = "%F %T" 
)
inline

◆ toString< std::string >()

template<>
std::string dev::toString< std::string > ( std::string const &  _s)
inline

◆ toString< uint8_t >()

template<>
std::string dev::toString< uint8_t > ( uint8_t const &  _u)
inline

◆ trimFront()

template<class T >
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.

◆ utcTime()

int64_t dev::utcTime ( )

Get the current time in seconds since the epoch in UTC.

◆ valuesOf() [1/2]

template<class T , class U >
std::vector<U> dev::valuesOf ( std::map< T, U > const &  _m)

◆ valuesOf() [2/2]

template<class T , class U >
std::vector<U> dev::valuesOf ( std::unordered_map< T, U > const &  _m)

◆ verify() [1/2]

bool dev::verify ( Public const &  _k,
Signature const &  _s,
h256 const &  _hash 
)

Verify signature.

◆ verify() [2/2]

bool dev::verify ( PublicCompressed const &  _key,
h512 const &  _signature,
h256 const &  _hash 
)

Variable Documentation

◆ c_rlpDataImmLenCount

const ::byte dev::c_rlpDataImmLenCount = c_rlpListStart - c_rlpDataImmLenStart - c_rlpMaxLengthBytes
static

◆ c_rlpDataImmLenStart

const ::byte dev::c_rlpDataImmLenStart = 0x80
static

◆ c_rlpDataIndLenZero

const ::byte dev::c_rlpDataIndLenZero = c_rlpDataImmLenStart + c_rlpDataImmLenCount - 1
static

◆ c_rlpListImmLenCount

const ::byte dev::c_rlpListImmLenCount = 256 - c_rlpListStart - c_rlpMaxLengthBytes
static

◆ c_rlpListIndLenZero

const ::byte dev::c_rlpListIndLenZero = c_rlpListStart + c_rlpListImmLenCount - 1
static

◆ c_rlpListStart

const ::byte dev::c_rlpListStart = 0xc0
static

◆ c_rlpMaxLengthBytes

const ::byte dev::c_rlpMaxLengthBytes = 8
static

◆ c_steadyClockMin

const auto dev::c_steadyClockMin = std::chrono::steady_clock::time_point::min()
static

◆ EmptyString

std::string const dev::EmptyString

◆ NullBytes

bytes const dev::NullBytes

◆ RLPEmptyList

bytes dev::RLPEmptyList = rlpList()
extern

The empty list in RLP format.

◆ RLPNull

bytes dev::RLPNull = rlp("")
extern

The empty string in RLP format.

◆ s_fixedHashEngine

std::random_device dev::s_fixedHashEngine
static

◆ Version

char const* dev::Version
extern

◆ ZeroAddress

Address const dev::ZeroAddress

The zero address.