Skip to content

Instantly share code, notes, and snippets.

@bjoerntx
Last active January 21, 2022 16:05
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 bjoerntx/73d699710b41e2f043fd3621ad41df68 to your computer and use it in GitHub Desktop.
Save bjoerntx/73d699710b41e2f043fd3621ad41df68 to your computer and use it in GitHub Desktop.
internal string GenerateBlockHash()
{
SHA256 sha256 = SHA256.Create();
byte[] bInput =
Encoding.ASCII.GetBytes($"{TimeStamp}-{PreviousBlockHash ?? ""}-{Data}-{Nonce}");
byte[] bOutput = sha256.ComputeHash(bInput);
return Base64UrlEncoder.Encode(bOutput);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment