Created
January 8, 2022 15:32
-
-
Save MCarlomagno/eee3d906d13b105482f9d0af38a3dd30 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
checksum256 get_hash(const string &task, const account_name &contract) | |
{ | |
checksum256 result; | |
size_t tasklen = strlen(task.c_str()); | |
char *buffer = (char *)malloc(tasklen + 8); | |
memcpy(buffer, &contract, 8); | |
memcpy(buffer + 8, task.data(), tasklen); | |
sha256(buffer, tasklen + 8, &result); | |
return result; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment