Skip to content

Instantly share code, notes, and snippets.

@k5trismegistus
Created October 29, 2018 03:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save k5trismegistus/c2dfc9d8a30df768d8ca21907dac9630 to your computer and use it in GitHub Desktop.
Save k5trismegistus/c2dfc9d8a30df768d8ca21907dac9630 to your computer and use it in GitHub Desktop.
#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