/usr/lib/nodejs/shasum/index.js is in node-shasum 1.0.2-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 | var createHash = require('crypto').createHash
var Buffer = require('buffer').Buffer
var stringify = require('json-stable-stringify')
module.exports = function hash (str, alg, format) {
str = 'string' === typeof str ? str
: Buffer.isBuffer(str) ? str
: stringify(str)
return createHash(alg || 'sha1')
.update(str, Buffer.isBuffer(str) ? null : 'utf8').digest(format || 'hex')
}
|