HORIZON HASKELLDocslts/ghc-9.14.xd82dee82026-10-12Search names, modules, packages, or :: a typeCtrl K

GHC 9.14.1 · lts/ghc-9.14.x · d82dee8 · 2026-10-12

Modulecardano-crypto-1.3.0Haskell2010

Crypto.Encoding.BIP39

  • 15 types
  • 17 values

Entropy

11 declarations
datadata Entropy (n :: Nat)
#

BIP39's entropy is a byte array of a given size (in bits, see ValidEntropySize for the valid size).

To it is associated

Instances9Eq, Show, NormalForm, Arbitrary, …
  • Eq (Entropy n)Defined in cardano-crypto-1.3.0 · Crypto.Encoding.BIP39
  • Show (Entropy n)Defined in cardano-crypto-1.3.0 · Crypto.Encoding.BIP39
  • NormalForm (Entropy n)Defined in cardano-crypto-1.3.0 · Crypto.Encoding.BIP39
  • Arbitrary (Entropy 128)Defined in cardano-crypto-1.3.0 · Crypto.Encoding.BIP39
  • Arbitrary (Entropy 160)Defined in cardano-crypto-1.3.0 · Crypto.Encoding.BIP39
  • Arbitrary (Entropy 192)Defined in cardano-crypto-1.3.0 · Crypto.Encoding.BIP39
  • Arbitrary (Entropy 224)Defined in cardano-crypto-1.3.0 · Crypto.Encoding.BIP39
  • Arbitrary (Entropy 256)Defined in cardano-crypto-1.3.0 · Crypto.Encoding.BIP39
  • Arbitrary (Entropy 96)Defined in cardano-crypto-1.3.0 · Crypto.Encoding.BIP39
newtypenewtype Checksum (bits :: Nat)
#

this is the Checksum of a given Entropy

the Nat type parameter represent the size, in bits, of this checksum.

Instances3Eq, Show, NormalForm
  • Eq (Checksum bits)Defined in cardano-crypto-1.3.0 · Crypto.Encoding.BIP39
  • Show (Checksum bits)Defined in cardano-crypto-1.3.0 · Crypto.Encoding.BIP39
  • NormalForm (Checksum bits)Defined in cardano-crypto-1.3.0 · Crypto.Encoding.BIP39

Seed

4 declarations
newtypenewtype Seed
#
Instances8Eq, Ord, Show, IsString, Semigroup, Monoid, …
  • Eq SeedDefined in cardano-crypto-1.3.0 · Crypto.Encoding.BIP39
  • Ord SeedDefined in cardano-crypto-1.3.0 · Crypto.Encoding.BIP39
  • Show SeedDefined in cardano-crypto-1.3.0 · Crypto.Encoding.BIP39
  • IsString SeedDefined in cardano-crypto-1.3.0 · Crypto.Encoding.BIP39
  • Semigroup SeedDefined in cardano-crypto-1.3.0 · Crypto.Encoding.BIP39
  • Monoid SeedDefined in cardano-crypto-1.3.0 · Crypto.Encoding.BIP39
  • ByteArray SeedDefined in cardano-crypto-1.3.0 · Crypto.Encoding.BIP39
  • ByteArrayAccess SeedDefined in cardano-crypto-1.3.0 · Crypto.Encoding.BIP39

Mnemonic Sentence

11 declarations
newtypenewtype MnemonicSentence (mw :: Nat)
#

Mnemonic Sentence is a list of WordIndex.

This is the generic representation of a mnemonic phrase that can be used for transalating to a different dictionary (example: English to Japanese).

This is mainly used to convert from/to the Entropy and for cardanoSlSeed

Instances6IsList, Eq, Ord, Show, NormalForm, Item
newtypenewtype MnemonicPhrase (mw :: Nat)
#

Human readable representation of a MnemonicSentence

Instances6IsList, Eq, Ord, Show, NormalForm, Item

Dictionary

datadata Dictionary
#

this discribe the property of the Dictionary and will alllow to convert from a mnemonic phrase to MnemonicSentence

This is especially needed to build the BIP39 Seed

Constructors

newtypenewtype WordIndex
#

Index of the mnemonic word in the Dictionary

WordIndex are within range of [0..2047]

Instances8Bounded, Enum, Eq, Ord, Show, NormalForm, …
  • Bounded WordIndexDefined in cardano-crypto-1.3.0 · Crypto.Encoding.BIP39.Dictionary
  • Enum WordIndexDefined in cardano-crypto-1.3.0 · Crypto.Encoding.BIP39.Dictionary
  • Eq WordIndexDefined in cardano-crypto-1.3.0 · Crypto.Encoding.BIP39.Dictionary
  • Ord WordIndexDefined in cardano-crypto-1.3.0 · Crypto.Encoding.BIP39.Dictionary
  • Show WordIndexDefined in cardano-crypto-1.3.0 · Crypto.Encoding.BIP39.Dictionary
  • NormalForm WordIndexDefined in cardano-crypto-1.3.0 · Crypto.Encoding.BIP39.Dictionary
  • TryFrom Int WordIndexDefined in cardano-crypto-1.3.0 · Crypto.Encoding.BIP39.Dictionary
  • TryFrom (Offset String) WordIndexDefined in cardano-crypto-1.3.0 · Crypto.Encoding.BIP39.Dictionary

helpers

3 declarations
typetype ConsistentEntropy (ent :: Nat) (mw :: Nat) (csz :: Nat) = (ValidEntropySize ent, ValidChecksumSize ent csz, ValidMnemonicSentence mw, MnemonicWords ent ~ mw)
#

Type Constraint Alias to check the entropy size, the number of mnemonic words and the checksum size is consistent. i.e. that the following is true:

| entropysize | checksumsize | entropysize + checksumsize | mnemonicsize | +---------------+--------------+----------------------------+--------------+ | 96 | 3 | 99 | 9 | | 128 | 4 | 132 | 12 | | 160 | 5 | 165 | 15 | | 192 | 6 | 198 | 18 | | 224 | 7 | 231 | 21 | | 256 | 8 | 264 | 24 |

This type constraint alias also perform all the GHC's cumbersome type level literal handling.

Errors

3 declarations