diff options
Diffstat (limited to 'src/Crypto/Hash/Types/Digest/Read.hs')
-rw-r--r-- | src/Crypto/Hash/Types/Digest/Read.hs | 20 |
1 files changed, 0 insertions, 20 deletions
diff --git a/src/Crypto/Hash/Types/Digest/Read.hs b/src/Crypto/Hash/Types/Digest/Read.hs deleted file mode 100644 index f371f30..0000000 --- a/src/Crypto/Hash/Types/Digest/Read.hs +++ /dev/null | |||
@@ -1,20 +0,0 @@ | |||
1 | {-# OPTIONS_GHC -fno-warn-orphans #-} | ||
2 | {-# LANGUAGE InstanceSigs #-} | ||
3 | {-# LANGUAGE NoImplicitPrelude #-} | ||
4 | {-# LANGUAGE PartialTypeSignatures #-} | ||
5 | {-# LANGUAGE ViewPatterns #-} | ||
6 | module Crypto.Hash.Types.Digest.Read where | ||
7 | import Rebase.Prelude hiding (hash) | ||
8 | |||
9 | import Crypto.Hash | ||
10 | import Data.ByteArray.Encoding | ||
11 | import qualified Rebase.Data.Text as Text | ||
12 | |||
13 | instance HashAlgorithm a => | ||
14 | Read (Digest a) where | ||
15 | readsPrec :: Int -> (String -> [(Digest a, String)]) | ||
16 | readsPrec _ (Text.encodeUtf8 . Text.pack -> bytes) = | ||
17 | toList $ (flip (,) "") <$> (digestFromByteString =<< baseConv bytes) | ||
18 | where | ||
19 | baseConv :: ByteString -> Maybe (ByteString) | ||
20 | baseConv = listToMaybe . toList . convertFromBase Base16 | ||