Files: b1ed4631de0942640e4c7591c2be9dbdf8e98240 / util.js
464 bytesRaw
1 | var crypto = require('crypto') |
2 | var pull = require('pull-stream') |
3 | |
4 | exports.createHash = function (type) { |
5 | var hash = crypto.createHash(type) |
6 | var hasher = pull.through(hash.update.bind(hash)) |
7 | hasher.hash = hash |
8 | hasher.digest = hash.digest.bind(hash) |
9 | return hasher |
10 | } |
11 | |
12 | exports.createGitObjectHash = function (objectType, objectLength) { |
13 | var hasher = exports.createHash('sha1') |
14 | hasher.hash.update(objectType + ' ' + objectLength + '\0') |
15 | return hasher |
16 | } |
17 |
Built with git-ssb-web