bittorrent-0.0.0.1: Bittorrent protocol implementation.

Portabilityportable
Stabilityexperimental
Maintainerpxqr.sta@gmail.com
Safe HaskellNone

Data.Torrent.InfoHash

Contents

Description

Infohash is a unique identifier of torrent.

Synopsis

Info hash

newtype InfoHash Source

Exactly 20 bytes long SHA1 hash of the info part of torrent file.

Constructors

InfoHash 

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 
BEncode InfoHash 
URL.URLShow InfoHash 

textToInfoHash :: Text -> Maybe InfoHashSource

Tries both base16 and base32 while decoding info hash.

addHashToURI :: URI -> InfoHash -> URISource

Add query info hash parameter to uri.

 info_hash=<url_encoded_info_hash>

ppInfoHash :: InfoHash -> DocSource

Pretty print info hash in hexadecimal format.

hash :: BS.ByteString -> InfoHashSource

Hash strict bytestring using SHA1 algorithm.

hashlazy :: BL.ByteString -> InfoHashSource

Hash lazy bytestring using SHA1 algorithm.