Socket
Socket
Sign inDemoInstall

object-hash

Package Overview
Dependencies
0
Maintainers
1
Versions
47
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.5.0 to 0.6.0

12

index.js

@@ -130,3 +130,3 @@ 'use strict';

return keys.forEach(function(key){
hashFn.update(key);
hashFn.update(key, 'utf8');
if(!options.excludeValues) {

@@ -148,3 +148,3 @@ typeHasher(hashFn, options, context).dispatch(object[key]);

_error: function(err){
return hashFn.update('error:' + err.toString());
return hashFn.update('error:' + err.toString(), 'utf8');
},

@@ -155,6 +155,6 @@ _boolean: function(bool){

_string: function(string){
return hashFn.update('string:' + string);
return hashFn.update('string:' + string, 'utf8');
},
_function: function(fn){
return hashFn.update('fn:' + fn.toString());
return hashFn.update('fn:' + fn.toString(), 'utf8');
},

@@ -165,3 +165,3 @@ _number: function(number){

_xml: function(xml){
return hashFn.update('xml:' + xml.toString());
return hashFn.update('xml:' + xml.toString(), 'utf8');
},

@@ -175,3 +175,3 @@ _null: function(){

_regexp: function(regex){
return hashFn.update('regex:' + regex.toString());
return hashFn.update('regex:' + regex.toString(), 'utf8');
},

@@ -178,0 +178,0 @@ _uint8array: function(arr){

{
"name": "object-hash",
"version": "0.5.0",
"version": "0.6.0",
"description": "Generate hashes from javascript objects in node and the browser.",

@@ -5,0 +5,0 @@ "homepage": "https://github.com/puleos/object-hash",

@@ -145,2 +145,10 @@ var test = require('tape');

test("utf8 strings are hashed correctly", function(assert) {
assert.plan(1);
var hash1 = hash('\u03c3'); // cf 83 in utf8
var hash2 = hash('\u01c3'); // c7 83 in utf8
console.log('!!', hash1, hash2);
assert.notEqual(hash1, hash2, "different strings with similar utf8 encodings should produce different hashes");
});
if (typeof Buffer !== 'undefined') {

@@ -147,0 +155,0 @@ test("Buffers can be hashed", function(assert) {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc