Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't stringify the contents of files before passing them to md5 hasher. #167

Merged
merged 1 commit into from
Jul 19, 2018

Conversation

wbprice
Copy link
Contributor

@wbprice wbprice commented Feb 16, 2017

As demonstrated here, passing a stringified image buffer to the hashing function will yield a different result than if we were to pass an image buffer:

// revisioner.js line 157
    file.revHashOriginal = this.Tool.md5(String(file.contents));
// tool.js lines 65-69
var md5 = function (str) {

    return crypto.createHash('md5').update(str, 'utf8').digest('hex');

};

The above causes images to be hashed inaccurately.

Hash#update accepts a buffer or string as the first argument, when md5 is used again to hash the consolidated hash, it still works.

// revisioner.js lines 310-311
// Consolidate many hashes into one
hash = this.Tool.md5(hash);

Fixes #129

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants