Skip to content

Instantly share code, notes, and snippets.

@janl
Last active August 29, 2015 14:16
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 janl/f7af55be5336007e8229 to your computer and use it in GitHub Desktop.
Save janl/f7af55be5336007e8229 to your computer and use it in GitHub Desktop.
- var hash = crypt.createHash('sha256');
- hash.update(assetData);
- return hash.digest('hex');
+ return crypt.createHash('sha256')
+ .update(assetData)
+ .digest('hex');
@ro-ka
Copy link

ro-ka commented Mar 10, 2015

Another possible way:

var hash = crypt.createHash('sha256')
  .update(assetData)
  .digest('hex');

return hash;

Longer, but I would prefer it.

@facundofarias
Copy link

I would prefer the shorter one 👍

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