src/utils/message.cpp
/**
 * @brief Sign a message using the given passphrase.
 *
 * @param string message
 * @param string passphrase
 *
 * @return bool
 **/
@brief Sign a message using the given passphrase.
@param string message
@param string passphrase

@return bool
@brief Sign a message using the given passphrase . @param string message @param string passphrase @return bool
bool Ark::Crypto::Utils::Message::sign(std::string newMessage, const char *const passphrase) {
  this->message = newMessage;
  PrivateKey privateKey = Ark::Crypto::Identities::PrivateKey::fromPassphrase(passphrase);
  this->publicKey = Ark::Crypto::Identities::PublicKey::fromPrivateKey(privateKey);
  const auto unsignedMessage = reinterpret_cast<const unsigned char *>(message.c_str());
  const auto hash = Sha256::getHash(unsignedMessage, this->message.length());
  cryptoSign(hash, privateKey, this->signature);
  return this->verify();
}
bool Ark :: Crypto :: Utils :: Message :: sign ( std :: string newMessage , const char * const passphrase ) { this -> message = newMessage ; PrivateKey privateKey = Ark :: Crypto :: Identities :: PrivateKey :: fromPassphrase ( passphrase ) ; this -> publicKey = Ark :: Crypto :: Identities :: PublicKey :: fromPrivateKey ( privateKey ) ; const auto unsignedMessage = reinterpret_cast < const unsigned char * > ( message . c_str ( ) ) ; const auto hash = Sha256 :: getHash ( unsignedMessage , this -> message . length ( ) ) ; cryptoSign ( hash , privateKey , this -> signature ) ; return this -> verify ( ) ; }
@brief Sign a message using the given passphrase.
@brief Sign a message using the given passphrase .
/* Get the PrivateKey */ /* Set the PublicKey from the derived PrivateKey */ /* Get the Hash */ /* Sign it */