]> Sergey Matveev's repositories - btrtrc.git/commitdiff
it is actually sha1 hash size
authorAlexey Kuznetsov <axet@me.com>
Sun, 24 Jul 2016 17:26:30 +0000 (20:26 +0300)
committerMatt Joiner <anacrolix@gmail.com>
Fri, 29 Jul 2016 12:50:58 +0000 (22:50 +1000)
torrent.go

index 147c3a98b1e6585a32b623b0b1390ce06989a82e..eefee14c2f0b10335567d9076fdd4c70422566f1 100644 (file)
@@ -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
 }