25 #include <boost/endian/conversion.hpp> 29 namespace graphene {
namespace protocol {
32 const string& msg, uint64_t custom_nonce)
38 if( 0 == custom_nonce )
41 constexpr uint64_t half_size = 32;
42 constexpr uint64_t high_bits = 0xff00000000000000ULL;
43 constexpr uint64_t low_bits = 0x00ffffffffffffffULL;
44 entropy <<= half_size;
57 message = vector<char>(text.begin(), text.end());
81 auto serial_checksum = string(
sizeof(checksum),
' ');
82 (uint32_t&)(*serial_checksum.data()) = boost::endian::native_to_little(checksum);
83 return serial_checksum + text;
90 result.
checksum = boost::endian::little_to_native((uint32_t&)(*serial.data()));
unsigned aes_encrypt(unsigned char *plaintext, int plaintext_len, unsigned char *key, unsigned char *iv, unsigned char *ciphertext)
fc::sha512 get_shared_secret(const public_key &pub) const
public_key get_public_key() const
static sha224 hash(const char *d, uint32_t dlen)
static sha512 hash(const char *d, uint32_t dlen)
std::string get_message(const fc::ecc::private_key &priv, const fc::ecc::public_key &pub) const
defines a message and checksum to enable validation of successful decryption
boost::endian::little_uint32_buf_t _hash[7]
static sha256 hash(const char *d, uint32_t dlen)
boost::endian::little_uint64_buf_t _hash[4]
static private_key generate()
contains only the public point of an elliptic curve key.
const microseconds & time_since_epoch() const
#define FC_ASSERT(TEST,...)
Checks a condition and throws an assert_exception if the test is FALSE.
#define GRAPHENE_IMPLEMENT_EXTERNAL_SERIALIZATION(type)
std::string to_string(double)
void set_message(const fc::ecc::private_key &priv, const fc::ecc::public_key &pub, const string &msg, uint64_t custom_nonce=0)
unsigned aes_decrypt(unsigned char *ciphertext, int ciphertext_len, unsigned char *key, unsigned char *iv, unsigned char *plaintext)
static memo_message deserialize(const string &serial)
an elliptic curve private key.
defines the keys used to derive the shared secret