use simple-sha1

This commit is contained in:
Feross Aboukhadijeh 2015-01-04 21:54:47 -08:00
parent 463c5278c5
commit 633f2ad531
2 changed files with 4 additions and 4 deletions

View File

@ -2,7 +2,7 @@ var bencode = require('bencode')
var BitField = require('bitfield') var BitField = require('bitfield')
var EventEmitter = require('events').EventEmitter var EventEmitter = require('events').EventEmitter
var inherits = require('inherits') var inherits = require('inherits')
var sha1 = require('git-sha1') var sha1 = require('simple-sha1')
var MAX_METADATA_SIZE = 10000000 // 10MB var MAX_METADATA_SIZE = 10000000 // 10MB
var BITFIELD_GROW = 1000 var BITFIELD_GROW = 1000
@ -126,7 +126,7 @@ module.exports = function (metadata) {
} catch (err) {} } catch (err) {}
// check hash // check hash
if (this._infoHashHex && this._infoHashHex !== sha1(metadata)) { if (this._infoHashHex && this._infoHashHex !== sha1.sync(metadata)) {
return false return false
} }

View File

@ -13,8 +13,8 @@
"dependencies": { "dependencies": {
"bencode": "^0.6.0", "bencode": "^0.6.0",
"bitfield": "^1.0.1", "bitfield": "^1.0.1",
"git-sha1": "^0.1.2", "inherits": "^2.0.1",
"inherits": "^2.0.1" "simple-sha1": "^2.0.0"
}, },
"devDependencies": { "devDependencies": {
"bittorrent-protocol": "^1.0.0", "bittorrent-protocol": "^1.0.0",