npm.io
1.0.2 • Published 2 months agoCLI

commonform-hash

Licence
BlueOak-1.0.0
Version
1.0.2
Deps
2
Size
4 kB
Vulns
0
Weekly
0

commonform-hash

cryptographically hash Common Forms

This package wraps different implementations of SHA-256, one for the browser, via browserify, and the other for Node.js, via the core crypto module.

var hash = require('commonform-hash')
var assert = require('assert')

assert.strictEqual(
  hash({ content: [ 'This is a form.' ] }),
  '0cb94c21d8e303ae4785e9433afe33132b4fe76275ae96d9b2d0b10a6fdf716a'
)

assert.strictEqual(
  hash({ conspicuous: 'yes', content: [ 'This is a form.' ] }),
  '76b69d4004186e35b26fb816835a92de5cfa8b1e553e45516b878bb3d35187d5'
)

assert.strictEqual(
  hash({ content: [ 'This is a form.' ], conspicuous: 'yes' }),
  '76b69d4004186e35b26fb816835a92de5cfa8b1e553e45516b878bb3d35187d5'
)

Keywords