From 49315045a0b0e450a6877712e84577f5b11a7703 Mon Sep 17 00:00:00 2001 From: Alexey Kuznetsov Date: Sun, 24 Jul 2016 20:26:30 +0300 Subject: [PATCH] it is actually sha1 hash size --- torrent.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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 } -- 2.48.1