28 namespace graphene {
namespace utilities {
32 const size_t size_of_data_to_hash =
sizeof(secret) + 1;
33 const size_t size_of_hash_bytes = 4;
34 char data[size_of_data_to_hash + size_of_hash_bytes];
36 memcpy(&data[1], (
char*)&secret,
sizeof(secret));
39 memcpy(data + size_of_data_to_hash, (
char*)&digest, size_of_hash_bytes);
49 std::vector<char> wif_bytes;
54 catch (
const fc::parse_error_exception&)
58 if (wif_bytes.size() < 5)
60 std::vector<char> key_bytes(wif_bytes.begin() + 1, wif_bytes.end() - 4);
65 if( memcmp( (
char*)&check, wif_bytes.data() + wif_bytes.size() - 4, 4 ) == 0 ||
66 memcmp( (
char*)&check2, wif_bytes.data() + wif_bytes.size() - 4, 4 ) == 0 )
std::string to_base58(const char *d, size_t s)
fc::optional< fc::ecc::private_key > wif_to_key(const std::string &wif_key)
static sha256 hash(const char *d, uint32_t dlen)
provides stack-based nullable value similar to boost::optional
std::string key_to_wif(const fc::sha256 &private_secret)
fc::sha256 digest(const T &value)
T as(uint32_t max_depth) const
stores null, int64, uint64, double, bool, string, std::vector<variant>, and variant_object's.
private_key_secret get_secret() const
std::vector< char > from_base58(const std::string &base58_str)
an elliptic curve private key.