You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

74 lines
1.8 KiB

3 months ago
  1. # hash-sum
  2. > blazing fast unique hash generator
  3. # install
  4. ```shell
  5. npm i hash-sum -S
  6. ```
  7. # features
  8. - no dependencies
  9. - minimal footprint
  10. - works in all of node.js, io.js, and the browser
  11. - hashes functions based on their source code
  12. - produces different hashes for different object types
  13. - support for circular references in objects
  14. - ignores property assignment order
  15. # `sum(value)`
  16. yields a four-byte hexadecimal hash based off of `value`.
  17. ```
  18. # creates unique hashes
  19. 00a34759 from: [ 0, 1, 2, 3 ]
  20. a8996f0c from: { '0': 0, '1': 1, '2': 2, '3': 3 }
  21. 5b4c2116 from: { '0': 0, '1': 1, '2': 2, '3': 3, length: 4 }
  22. 2c937c45 from: { url: 12 }
  23. 31d55010 from: { headers: 12 }
  24. 2d2e11bc from: { headers: 122 }
  25. ec99d958 from: { headers: '122' }
  26. 18c00eee from: { headers: { accept: 'text/plain' } }
  27. 6cb332c8 from: { payload: [ 0, 1, 2, 3 ], headers: [ { a: 'b' } ] }
  28. 12ff55db from: { a: [Function: a] }
  29. 46f806d2 from: { b: [Function: b] }
  30. 0660d9c4 from: { b: [Function: b] }
  31. 6c95fc65 from: function () {}
  32. 2941766e from: function (a) {}
  33. 294f8def from: function (b) {}
  34. 2d9c0cb8 from: function (a) { return a;}
  35. ed5c63fc from: function (a) {return a;}
  36. bba68bf6 from: ''
  37. 2d27667d from: 'null'
  38. 774b96ed from: 'false'
  39. 2d2a1684 from: 'true'
  40. 8daa1a0c from: '0'
  41. 8daa1a0a from: '1'
  42. e38f07cc from: 'void 0'
  43. 6037ea1a from: 'undefined'
  44. 9b7df12e from: null
  45. 3c206f76 from: false
  46. 01e34ba8 from: true
  47. 8a8f9624 from: Infinity
  48. 0315bf8f from: -Infinity
  49. 64a48b16 from: NaN
  50. 1a96284a from: 0
  51. 1a96284b from: 1
  52. 29172c1a from: undefined
  53. 59322f29 from: {}
  54. 095b3a22 from: { a: {}, b: {} }
  55. 63be56dd from: { valueOf: [Function: valueOf] }
  56. 63be4f5c from: { valueOf: [Function: valueOf] }
  57. 5d844489 from: []
  58. ba0bfa14 from: 2019-06-28T21:24:31.215Z
  59. 49324d16 from: 2019-06-28T03:00:00.000Z
  60. 434c9188 from: 1988-06-09T03:00:00.000Z
  61. ce1b5e44 from: global
  62. ```
  63. # license
  64. MIT