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

Binary data not hashed correctly #14

Open
kornelski opened this issue Mar 10, 2011 · 3 comments
Open

Binary data not hashed correctly #14

kornelski opened this issue Mar 10, 2011 · 3 comments

Comments

@kornelski
Copy link

fs.readFile(file_path, undefined, function(err, data) {
    console.log(hashlib.sha1(data));
});

If file at file_path contains ASCII, the hash is correct. However, binary files get wrong hash.

Could you add support for this case? (as far as I understand, in this case node.js returns data in raw encoding, so sha1() could read it properly). Alternatively, add sha1_file()?

@msm595
Copy link

msm595 commented Aug 5, 2011

I would like this to be resolved as well. :)

@poelzi
Copy link
Contributor

poelzi commented Sep 12, 2011

this one cost me like half a day :-(

> hashlib.sha256(buffalo.serialize([[909, true]]))
'1f379a96dc47a2244a5c888bd7e9b5b85819b33f3e8dfc1a32f4976847fc53de'
> hashlib.sha256(buffalo.serialize([[910, true]]))
'1f379a96dc47a2244a5c888bd7e9b5b85819b33f3e8dfc1a32f4976847fc53de'
> hashlib.sha256(buffalo.serialize([[910, true]]).toString())
'1f379a96dc47a2244a5c888bd7e9b5b85819b33f3e8dfc1a32f4976847fc53de'
> hashlib.sha256(buffalo.serialize([[909, true]]).toString())
'1f379a96dc47a2244a5c888bd7e9b5b85819b33f3e8dfc1a32f4976847fc53de'

@poelzi
Copy link
Contributor

poelzi commented Sep 13, 2011

#21

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

No branches or pull requests

3 participants