Skip to content

Instantly share code, notes, and snippets.

@rubensayshi
Last active June 21, 2016 01:32
Show Gist options
  • Save rubensayshi/9571123 to your computer and use it in GitHub Desktop.
Save rubensayshi/9571123 to your computer and use it in GitHub Desktop.
var bitutil = require('bitcore/util/util');
// ouput being spend: http://blockexplorer.com/tx/a4bfa8ab6435ae5f25dae9d89e4eb67dfa94283ca751f393c1ddc5a837bbc31b#o0
// taken from http://blockexplorer.com/tx/09f691b2263260e71f363d1db51ff3100d285956a40cc0e4f8c8c2c4a80559b1
var input = "0100000000000000000000000000000000000000000000000000000000000000000000003BA3EDFD7A7B12B27AC72C3E67768F617FC81BC3888A51323A9FB8AA4B1E5E4A29AB5F49FFFF001D1DAC2B7C"
bitutil.twoSha256(input) // why isn't this 6fe28c0ab6f1b372c1a6a246ae63f74f931e8365e15a089c68d6190000000000 ?
@segrax
Copy link

segrax commented Jun 21, 2016

Because most display the hash in big endian, so the leading zeros are shown first,

6fe28c0ab6f1b372c1a6a246ae63f74f931e8365e15a089c68d6190000000000 < Little Endian
000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f < Big Endian

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment