From: Alexey Kuznetsov Date: Sun, 24 Jul 2016 17:26:30 +0000 (+0300) Subject: it is actually sha1 hash size X-Git-Tag: v1.0.0~623 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=49315045a0b0e450a6877712e84577f5b11a7703;p=btrtrc.git it is actually sha1 hash size --- diff --git a/torrent.go b/torrent.go index 147c3a98..eefee14c 100644 --- a/torrent.go +++ b/torrent.go @@ -2,6 +2,7 @@ package torrent import ( "container/heap" + "crypto/sha1" "errors" "fmt" "io" @@ -202,8 +203,8 @@ func (t *Torrent) metadataSize() int { } func infoPieceHashes(info *metainfo.Info) (ret []string) { - for i := 0; i < len(info.Pieces); i += 20 { - ret = append(ret, string(info.Pieces[i:i+20])) + for i := 0; i < len(info.Pieces); i += sha1.Size { + ret = append(ret, string(info.Pieces[i:i+sha1.Size])) } return }