Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#include <stdio.h>
#include <string>
#include <eosiolib/eosio.hpp>
#include <eosiolib/crypto.h>
using namespace eosio;
class Hashtest : public contract {
public:
// constructor
Hashtest(account_name s):contract(s)
{}
//@abi action
void version()
{
print("0.0.1");
}
//@abi action
void hash(std::string s)
{
// variable to get result from hashing all players hashes and secrets
checksum256 result;
// hash the contents in memory, starting at game.player1 and spanning for
// sizeof(player)*2 bytes
sha256( (char *)&s, 8, &result);
}
};
EOSIO_ABI(Hashtest, (version)(hash));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment