/usr/lib/nodejs/create-hash/make-hash.js is in node-create-hash 1.1.3-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 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | 'use strict'
var intSize = 4
var zeroBuffer = new Buffer(intSize)
zeroBuffer.fill(0)
var charSize = 8
var hashSize = 16
function toArray (buf) {
if ((buf.length % intSize) !== 0) {
var len = buf.length + (intSize - (buf.length % intSize))
buf = Buffer.concat([buf, zeroBuffer], len)
}
var arr = new Array(buf.length >>> 2)
for (var i = 0, j = 0; i < buf.length; i += intSize, j++) {
arr[j] = buf.readInt32LE(i)
}
return arr
}
module.exports = function hash (buf, fn) {
var arr = fn(toArray(buf), buf.length * charSize)
buf = new Buffer(hashSize)
for (var i = 0; i < arr.length; i++) {
buf.writeInt32LE(arr[i], i << 2, true)
}
return buf
}
|