Skip to content

Binary data not hashed correctly #14

@kornelski

Description

@kornelski
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()?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions