module Codec.Digest.SHA.Misc where import qualified Data.ByteString as B import qualified Numeric(showHex) import Data.Word(Word8) -- | Converts a ByteString to hexadeximal string format showBSasHex :: B.ByteString -> String showBSasHex bs | B.null bs = "" showBSasHex bs = showHex (B.index bs 0) $ showBSasHex (B.drop 1 bs) showHex :: Word8 -> String -> String showHex n rest | n < 0x10 = Numeric.showHex 0 (Numeric.showHex n rest) showHex n rest = Numeric.showHex n rest