diff options
Diffstat (limited to 'src/Data/Torrent/InfoHash.hs')
-rw-r--r-- | src/Data/Torrent/InfoHash.hs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/Data/Torrent/InfoHash.hs b/src/Data/Torrent/InfoHash.hs index e15fdbb3..3d2bbe25 100644 --- a/src/Data/Torrent/InfoHash.hs +++ b/src/Data/Torrent/InfoHash.hs | |||
@@ -22,6 +22,7 @@ module Data.Torrent.InfoHash | |||
22 | 22 | ||
23 | , addHashToURI | 23 | , addHashToURI |
24 | 24 | ||
25 | -- * Internal | ||
25 | , Data.Torrent.InfoHash.hash | 26 | , Data.Torrent.InfoHash.hash |
26 | , Data.Torrent.InfoHash.hashlazy | 27 | , Data.Torrent.InfoHash.hashlazy |
27 | ) where | 28 | ) where |
@@ -111,7 +112,7 @@ instance Pretty InfoHash where | |||
111 | 112 | ||
112 | -- | Tries both base16 and base32 while decoding info hash. | 113 | -- | Tries both base16 and base32 while decoding info hash. |
113 | textToInfoHash :: Text -> Maybe InfoHash | 114 | textToInfoHash :: Text -> Maybe InfoHash |
114 | textToInfoHash text | 115 | textToInfoHash t |
115 | | hashLen == 32 = Just $ InfoHash $ Base32.decode hashStr | 116 | | hashLen == 32 = Just $ InfoHash $ Base32.decode hashStr |
116 | | hashLen == 40 = let (ihStr, inv) = Base16.decode hashStr | 117 | | hashLen == 40 = let (ihStr, inv) = Base16.decode hashStr |
117 | in if BS.length inv == 0 | 118 | in if BS.length inv == 0 |
@@ -120,7 +121,7 @@ textToInfoHash text | |||
120 | | otherwise = Nothing | 121 | | otherwise = Nothing |
121 | where | 122 | where |
122 | hashLen = BS.length hashStr | 123 | hashLen = BS.length hashStr |
123 | hashStr = T.encodeUtf8 text | 124 | hashStr = T.encodeUtf8 t |
124 | 125 | ||
125 | -- | Hex encode infohash to text, full length. | 126 | -- | Hex encode infohash to text, full length. |
126 | longHex :: InfoHash -> Text | 127 | longHex :: InfoHash -> Text |