arc-hash
Convenience ES6 hashing library. Supports object, array and string hashing for md5 and sha256
Install
$ npm install arc-hash --save
Features
- supports md5 and sha256
- supports arrays and objects that reduce to scalar values
Basic Usage
const ArcHash = require('arc-hash');
const exampleObject = {
'B': 5,
'D': {
'Zebra': 'Camel',
'Antelope': [0,2,
{
'Deep':'Mind'
},
['omega','alpha']
]
},
'A': 'Is a String',
};
console.log(ArcHash.md5(exampleObject));
API
ArcHash.md5(value:Unknown)
Take an unknown value and return an md5 hash representing it
ArcHash.sha256(value:Unknown)
Take an unknown value and return a sha256 hash representing it
NOTES & WARNINGS
- Array order matters for a hash, object order assignment does not.
- Keys and values are case sensitive
- Circular object references are not handled
- String() is eventually applied to all values, so 5 and '5' will not be seen as different values
- This is not incredibly performant, and should not be used for dynamic comparison over potentially large data sets
Testing
npm test