Distribution.Client.HashValue

cabal-install-3.12.1.0: The command-line interface for Cabal and Hackage.

Safe Haskell | None
Language | Haskell2010

Distribution.Client.HashValue

Synopsis

- data HashValue
- hashValue :: ByteString -> HashValue
- truncateHash :: Int -> HashValue -> HashValue
- showHashValue :: HashValue -> String
- readFileHashValue :: FilePath -> IO HashValue
- hashFromTUF :: Hash -> HashValue

# Documentation

data HashValue #

#### Instances

Instances details

Structured HashValue # |
Instance details Defined in Distribution.Client.HashValue Methods structure :: Proxy HashValue -> Structure # structureHash' :: Tagged HashValue MD5
Binary HashValue # |
Instance details Defined in Distribution.Client.HashValue Methods put :: HashValue -> Put # get :: Get HashValue # putList :: [HashValue] -> Put #
Generic HashValue # |
Instance details Defined in Distribution.Client.HashValue Associated Types
type Rep HashValue |
Instance details Defined in Distribution.Client.HashValue type Rep HashValue = D1 ('MetaData "HashValue" "Distribution.Client.HashValue" "cabal-install-3.12.1.0-G554PkJj2SpDqyarXp9tbt" 'True) (C1 ('MetaCons "HashValue" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ByteString)))
Methods from :: HashValue -> Rep HashValue x # to :: Rep HashValue x -> HashValue #
Show HashValue # |
Instance details Defined in Distribution.Client.HashValue Methods showsPrec :: Int -> HashValue -> ShowS # show :: HashValue -> String # showList :: [HashValue] -> ShowS #
Eq HashValue # |
Instance details Defined in Distribution.Client.HashValue Methods (==) :: HashValue -> HashValue -> Bool # (/=) :: HashValue -> HashValue -> Bool #
type Rep HashValue # |
Instance details Defined in Distribution.Client.HashValue type Rep HashValue = D1 ('MetaData "HashValue" "Distribution.Client.HashValue" "cabal-install-3.12.1.0-G554PkJj2SpDqyarXp9tbt" 'True) (C1 ('MetaCons "HashValue" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ByteString)))

hashValue :: ByteString -> HashValue #

Hash some data. Currently uses SHA256.

truncateHash :: Int -> HashValue -> HashValue #

Truncate a 32 byte SHA256 hash to

For example 20 bytes render as 40 hex chars, which we use for unit-ids. Or even 4 bytes for `hashedInstalledPackageIdShort`

showHashValue :: HashValue -> String #

readFileHashValue :: FilePath -> IO HashValue #

Hash the content of a file. Uses SHA256.

hashFromTUF :: Hash -> HashValue #

Convert a hash from TUF metadata into a `PackageSourceHash`.

Note that TUF hashes don't necessarily have to be SHA256, since it can support new algorithms in future.