richardgirges / express-fileupload

Simple express file upload middleware that wraps around busboy
MIT License
1.52k stars 261 forks source link

Added 'hashAlgorithm' options to use another algorithm for hashing file content other than md5 #245

Closed remtori closed 2 months ago

remtori commented 4 years ago

Like the title said, this PR added 'hashAlgorithm' options to specify other hash algorithm than md5.

In my use case, i need sha1 content hash instead of md5 so i will use its like:

const fileUpload = require('express-fileupload');

// omited

app.use(fileUpload({ 
    useTempFiles: true,
    hashAlgorithm: 'sha1',
});

app.post('/upload', (req, res) => {
    console.log('File content sha1 hash: ' + req.files.file.sha1);
    res.send('Ok');
});
Cerothen commented 3 years ago

I'd be a big fan if this PR got merged and released as I too would like to use a hash algorithm that is less likely to have a collision.

As noted in another PR the test that failed is also failing in the master build and isn't related to the changes. https://github.com/richardgirges/express-fileupload/pull/253#issuecomment-717665051

barucoh commented 2 months ago

Any update on this? I also need to use a different hash algorithm than md5

RomanBurunkov commented 2 months ago

Done with #375