Files: f60f57ddecf31964b98f5147c7ee02faa6c871fc / 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