raaz-0.2.1: The raaz cryptographic library.

Safe Haskell | None
Language | Haskell2010

Raaz.Hash.Sha1

Contents

- The broken SHA1 cryptographic hash.
- HMAC computation using SHA1

Description

Deprecated: SHA1 is broken. This module is here only for transition.

This module exposes combinators to compute the SHA1 hash and the associated HMAC for some common types.

Synopsis

- data SHA1
- sha1 :: PureByteSource src => src -> SHA1
- sha1File :: FilePath -> IO SHA1
- sha1Source :: ByteSource src => src -> IO SHA1
- hmacSha1 :: PureByteSource src => Key (HMAC SHA1) -> src -> HMAC SHA1
- hmacSha1File :: Key (HMAC SHA1) -> FilePath -> IO (HMAC SHA1)
- hmacSha1Source :: ByteSource src => Key (HMAC SHA1) -> src -> IO (HMAC SHA1)

# The broken SHA1 cryptographic hash.

We already have a collision for SHA1: https://security.googleblog.com/2017/02/announcing-first-sha1-collision.html

While it does not yet rule out SHA1 for some specific tasks, there is no reason for its continual usage. This module is present only to facilitate the transition to a better hash. Use it assuming no security guarantees. Raaz will not try to optimise the implementations given here and will remove this module at some point of time. So do not rely on this for your software.

data SHA1 Source #

The cryptographic hash SHA1.

#### Instances

Instances details

Eq SHA1 Source # |
Instance details Defined in Raaz.Hash.Sha1.Internal Methods (==) :: SHA1 -> SHA1 -> Bool Source # (/=) :: SHA1 -> SHA1 -> Bool Source #
Show SHA1 Source # |
Instance details Defined in Raaz.Hash.Sha1.Internal Methods showsPrec :: Int -> SHA1 -> ShowS Source # show :: SHA1 -> String Source # showList :: [SHA1] -> ShowS Source #
IsString SHA1 Source # |
Instance details Defined in Raaz.Hash.Sha1.Internal Methods fromString :: String -> SHA1 Source #
Storable SHA1 Source # |

Instance details

Defined in Raaz.Hash.Sha1.Internal

Methods

sizeOf :: SHA1 -> Int Source #

alignment :: SHA1 -> Int Source #

peekElemOff :: Ptr SHA1 -> Int -> IO SHA1 Source #

pokeElemOff :: Ptr SHA1 -> Int -> SHA1 -> IO () Source #

peekByteOff :: Ptr b -> Int -> IO SHA1 Source #

pokeByteOff :: Ptr b -> Int -> SHA1 -> IO () Source #

peek :: Ptr SHA1 -> IO SHA1 Source #

poke :: Ptr SHA1 -> SHA1 -> IO () Source #

Equality SHA1 Source # |
Instance details Defined in Raaz.Hash.Sha1.Internal Methods eq :: SHA1 -> SHA1 -> Result Source #
EndianStore SHA1 Source # |
Instance details Defined in Raaz.Hash.Sha1.Internal Methods store :: Ptr SHA1 -> SHA1 -> IO () Source # load :: Ptr SHA1 -> IO SHA1 Source # adjustEndian :: Ptr SHA1 -> Int -> IO () Source #
Encodable SHA1 Source # |
Instance details Defined in Raaz.Hash.Sha1.Internal Methods toByteString :: SHA1 -> ByteString Source # fromByteString :: ByteString -> Maybe SHA1 Source # unsafeFromByteString :: ByteString -> SHA1 Source #
Recommendation SHA1 Source # | Recommended implementation for SHA1.
Instance details Defined in Raaz.Hash.Sha1.Recommendation Methods recommended :: SHA1 -> Implementation SHA1 Source #
Primitive SHA1 Source # |
Instance details Defined in Raaz.Hash.Sha1.Internal Associated Types type Implementation SHA1 Source # Methods blockSize :: SHA1 -> BYTES Int Source #
Hash SHA1 Source # |
Instance details Defined in Raaz.Hash.Sha1.Internal Methods additionalPadBlocks :: SHA1 -> BLOCKS SHA1 Source #
Initialisable (HashMemory SHA1) () Source # |
Instance details Defined in Raaz.Hash.Sha1.Internal Methods initialise :: () -> MT (HashMemory SHA1) () Source #
type Implementation SHA1 Source # |
Instance details Defined in Raaz.Hash.Sha1.Internal type Implementation SHA1 = SomeHashI SHA1

sha1 :: PureByteSource src => src -> SHA1 Source #

Compute the sha1 hash of an instance of `PureByteSource`. Use this for computing the sha1 hash of a strict or lazy byte string.

sha1File :: FilePath -> IO SHA1 Source #

Compute the sha1 hash of a file.

sha1Source :: ByteSource src => src -> IO SHA1 Source #

Compute the sha1 hash of a general byte source.

# HMAC computation using SHA1

hmacSha1 :: PureByteSource src => Key (HMAC SHA1) -> src -> HMAC SHA1 Source #

Compute the message authentication code using hmac-sha1.

hmacSha1File :: Key (HMAC SHA1) -> FilePath -> IO (HMAC SHA1) Source #

Compute the message authentication code for a file.

hmacSha1Source :: ByteSource src => Key (HMAC SHA1) -> src -> IO (HMAC SHA1) Source #

Compute the message authetication code for a generic byte source.