func InfohashFromString(s string) (*Infohash, error) {
	switch len(s) {
	case 20:
		ih := Infohash([]byte(s))
		return &ih, nil
	case 40:
		b, err := hex.DecodeString(s)
		if err != nil {
			return nil, err
		}
		ih := Infohash(b)
		return &ih, nil
	default:
		return nil, fmt.Errorf("invalid length %d", len(s))
	}
}
InfohashFromString converts a 40 digit hexadecimal string to an Infohash
package models
import (
	"crypto/sha1"
	"encoding/hex"
	"fmt"
	"io"
	"math/rand"
	"time"
)
const InfohashLength = 20
type Infohash []byte