| Portability | portable |
|---|---|
| Stability | experimental |
| Maintainer | pxqr.sta@gmail.com |
| Safe Haskell | None |
Data.Torrent.InfoHash
Description
Infohash is a unique identifier of torrent.
Info hash
Exactly 20 bytes long SHA1 hash of the info part of torrent file.
Constructors
| InfoHash | |
Fields | |
Instances
| Eq InfoHash | |
| Ord InfoHash | |
| Read InfoHash | for hex encoded strings |
| Show InfoHash | for hex encoded strings |
| IsString InfoHash | for base16 (hex) encoded strings |
| ToJSON InfoHash | Represented as base16 encoded string. |
| FromJSON InfoHash | Can be base16 or base32 encoded string. |
| Serialize InfoHash | |
| Hashable.Hashable InfoHash | |
| URL.URLShow InfoHash | |
| Pretty InfoHash | base16 encoded. |
| BEncode InfoHash |
Parsing
textToInfoHash :: Text -> Maybe InfoHashSource
Tries both base16 and base32 while decoding info hash.
Rendering
addHashToURI :: URI -> InfoHash -> URISource
Add query info hash parameter to uri.
info_hash=<url_encoded_info_hash>
hash :: BS.ByteString -> InfoHashSource
Hash strict bytestring using SHA1 algorithm.
hashlazy :: BL.ByteString -> InfoHashSource
Hash lazy bytestring using SHA1 algorithm.