module NaCl.Hash
( HashSha256
, sha256
, HashSha512
, sha512
) where
import Data.ByteArray (ByteArray, ByteArrayAccess)
import System.IO.Unsafe (unsafePerformIO)
import NaCl.Hash.Internal (HashSha256, HashSha512)
import qualified NaCl.Hash.Internal as I
sha256
:: ( ByteArrayAccess pt
, ByteArray hashBytes
)
=> pt
-> HashSha256 hashBytes
sha256 :: pt -> HashSha256 hashBytes
sha256 pt
msg =
IO (HashSha256 hashBytes) -> HashSha256 hashBytes
forall a. IO a -> a
unsafePerformIO (IO (HashSha256 hashBytes) -> HashSha256 hashBytes)
-> IO (HashSha256 hashBytes) -> HashSha256 hashBytes
forall a b. (a -> b) -> a -> b
$ pt -> IO (HashSha256 hashBytes)
forall pt hashBytes.
(ByteArrayAccess pt, ByteArray hashBytes) =>
pt -> IO (HashSha256 hashBytes)
I.sha256 pt
msg
sha512
:: ( ByteArrayAccess pt
, ByteArray hashBytes
)
=> pt
-> HashSha512 hashBytes
sha512 :: pt -> HashSha512 hashBytes
sha512 pt
msg =
IO (HashSha512 hashBytes) -> HashSha512 hashBytes
forall a. IO a -> a
unsafePerformIO (IO (HashSha512 hashBytes) -> HashSha512 hashBytes)
-> IO (HashSha512 hashBytes) -> HashSha512 hashBytes
forall a b. (a -> b) -> a -> b
$ pt -> IO (HashSha512 hashBytes)
forall pt hashBytes.
(ByteArrayAccess pt, ByteArray hashBytes) =>
pt -> IO (HashSha512 hashBytes)
I.sha512 pt
msg