Skip to content

Instantly share code, notes, and snippets.

@dlongley
Created July 22, 2013 19:52
Show Gist options
  • Save dlongley/6057047 to your computer and use it in GitHub Desktop.
Save dlongley/6057047 to your computer and use it in GitHub Desktop.
Change this:
function payswarm_hash($obj) {
// SHA-1 hash JSON
$options = array('format' => 'application/nquads');
return 'urn:sha256:' . hash('sha256', jsonld_normalize($obj, $options));
}
To this:
function payswarm_hash($obj) {
// SHA-1 hash JSON
$options = array('format' => 'application/nquads');
$normalized = jsonld_normalize($obj, $options);
$fp = fopen('/tmp/somefiletologto.txt', 'a');
fwrite($fp, "\nNORMALIZED:\n$normalized\n");
fclose($fp);
return 'urn:sha256:' . hash('sha256', $normalized);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment