P      !"# $ % & ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ? @ A B C D E F GHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRST U V W X Y Z![!\!]!^!_!`!a!b!c"d"e"f"g"h"i"j"k"l"m"n"o"p"q"r#s#t#u$v$w$x%y%z%{%|%}%~%%%%&&&&&&&&&&&&''''''''''((((((((()))))))))))))))))))))))))))))))))))))))))))))))))))))*****+,----...................../////////000^1 BSD-style#Vincent Hanquez <vincent@snarc.org> experimentalunknownSafe2 BSD-style#Vincent Hanquez <vincent@snarc.org>stableCompatNone<$byteswap Word# to or from Big Endian0on a big endian machine, this function is a nop.'byteswap Word# to or from Little Endian3on a little endian machine, this function is a nop.VSimple compatibility for byteswap the lower 32 bits of a Word# at the primitive level<combine 4 word8 [a,b,c,d] to a word32 representing [a,b,c,d]pSimple wrapper to handle pre 7.8 and future, where most comparaison functions don't returns a boolean anymore.3 BSD-style#Vincent Hanquez <vincent@snarc.org> experimentalGoodSafe RA handle to an entropy maker, either a system capability or a hardware generator. %try to open an handle for this source btry to gather a number of entropy bytes into a buffer. return the number of actual bytes gathered Close an open handle            4 BSD-style#Vincent Hanquez <vincent@snarc.org> experimentalGoodSafe 3fake handle to Intel RDRand entropy cpu instruction   5 BSD-style#Vincent Hanquez <vincent@snarc.org> experimentalGoodSafeNEntropy device devurandom on unix system Entropy device devrandom on unix system  !  !6 BSD-style#Vincent Hanquez <vincent@snarc.org> experimentalunknownSafe"Split a # into the highest and lowest $%Reconstruct a # from two $"%&'"%"%7 BSD-style#Vincent Hanquez <vincent@snarc.org>stablegoodSafe;NAny Entropy BackendAll supported backends (Open a backend handle%Gather randomness from an open handle)(An open Entropy BackendPointer to a buffer to write tonumber of bytes to write+return the number of bytes actually written)( BSD-style#Vincent Hanquez <vincent@snarc.org> experimentalGoodSafeRefill the entropy in a bufferGcall each entropy backend in turn until the buffer has been replenish.YIf the buffer cannot be refill after 3 loopings, this will raise an User Error exception8 BSD-style#Vincent Hanquez <vincent@snarc.org> experimentalGoodSafe*This is a strict version of and+This is a strict version of &&.*+*+*+9 BSD-style#Vincent Hanquez <vincent@snarc.org> experimentalGoodNone< ,GMP Supported / Unsupported-DSimple combinator in case the operation is not supported through GMP.-Compute the GCDE of a two integer through GMP/6Compute the binary logarithm of an integer through GMP0XCompute the power modulus using extra security to remain constant time wise through GMP1%Compute the power modulus through GMP2'Inverse modulus of a number through GMP34Get the next prime from a specific value through GMP4,Test if a number is prime using Miller Rabin5%Return the size in bytes of a integer6Export an integer to a memory7Import an integer from a memory,89-./012345:67,89-./012345:67 ,89-./012345:67 BSD-style#Vincent Hanquez <vincent@snarc.org> experimentalGoodNonesqrti returns two integer (l,b) so that l <= sqrt i <= b the implementation is quite naive, use an approximation for the first number and use a dichotomy algorithm to compute the bound relatively efficiently.8get the extended GCD of two integer using integer divModgcde a b& find (x,y,gcd(a,b)) where ax + by = d'check if a list of integer are all even)Compute the binary logarithm of a integer)Compute the number of bits for an integer *Compute the number of bytes for an integer     BSD-style#Vincent Hanquez <vincent@snarc.org> experimentalGoodNone+;@Raised when two numbers are supposed to be coprimes but are not. zCompute the modular exponentiation of base^exponant using algorithms design to avoid side channels and timing measurementPModulo need to be odd otherwise the normal fast modular exponentiation is used.When used with integer-simple, this function is not different from expFast, and thus provide the same unstudied and dubious timing and side channels claims.with GHC 7.10, the powModSecInteger is missing from integer-gmp (which is now integer-gmp2), so is has the same security as old ghc version. Compute the modular exponentiation of base^exponant using the fastest algorithm without any consideration for hiding parameters.AUse this function when all the parameters are public, otherwise   should be prefered.<Wexponentiation computes modular exponentiation as b^e mod m using repetitive squaring. 7inverse computes the modular inverse as in g^(-1) mod m |Compute the modular inverse of 2 coprime numbers. This is equivalent to inverse except that the result is known to exists.^if the numbers are not defined as coprime, this function will raise a CoprimesAssertionError.;= baseexponantmoduloresult baseexponantmoduloresult< >  ;= < > BSD-style#Vincent Hanquez <vincent@snarc.org> experimentalGoodNoneFfill a pointer with the big endian binary representation of an integerif the room available @ptrSz is less than the number of bytes needed, 0 is returned. Likewise if a parameter is invalid, 0 is returned.#returns the number of bytes written Similar to 3, except it will pad any remaining space with zero.etransform a big endian binary integer representation pointed by a pointer and a size into an integer??: BSD-styleSafe35@a DES block (64 bits)ABasic DES encryption which takes a key and a block of plaintext and returns the encrypted block of ciphertext according to the standard.BBasic DES decryption which takes a key and a block of ciphertext and returns the decrypted block of plaintext according to the standard.'CDEFGHIJ@KLMNOPQRSTUVWXYZ[\]^_`abcdefAB@KLAB%CDEFGHIJ@KLMNOPQRSTUVWXYZ[\]^_`abcdefAB; BSD-style#Vincent Hanquez <vincent@snarc.org>stableGoodNonegperform io for hashes that do allocation and ffi. unsafeDupablePerformIO is used when possible as the computation is pure and the output is directly linked to the input. we also do not modify anything after it has been returned to the user.ghigg< BSD-style#Vincent Hanquez <vincent@snarc.org>stableGoodNone<jArray of mutable Word32kArray of Word64lArray of Word32mArray of Word8n*Create an array of Word8 aliasing an Addr#o@Create an Array of Word32 of specific size from a list of Word32p@Create an Array of Word64 of specific size from a list of Word64qGCreate a Mutable Array of Word32 of specific size from a list of Word32r4Create a Mutable Array of BE Word32 aliasing an AddrsAfreeze a Mutable Array of Word32 into a immutable Array of Word32tRead a Word8 from an ArrayuRead a Word32 from an ArrayvRead a Word64 from an Arrayw,Read a Word32 from a Mutable Array of Word32x-Write a Word32 from a Mutable Array of Word32ydWrite into the Mutable Array of Word32 by combining through xor the current value and the new value. x[i] = x[i] xor valuejzk{l|m}nopqrstuvwxyjklmnopqrstuvwxyjzk{l|m}nopqrstuvwxy= BSD-style experimentalGoodNone<~LCreate a key schedule mutable array of the pbox followed by all the sboxes.~~~> BSD-style#Vincent Hanquez <vincent@snarc.org>stableGoodNone7 BSD-style#Vincent Hanquez <vincent@snarc.org> experimentalunknownNoneC Poly1305 AuthPoly1305 Stateinitialize a Poly1305 context"update a context with a bytestring+updates a context with multiples bytestring-finalize the context into a digest bytestringOne-pass authorization creation    BSD-style#Vincent Hanquez <vincent@snarc.org> experimentalGoodNone4os2ip converts a byte string into a positive integer4i2osp converts a positive integer into a byte stringXfirst byte is MSB (most significant byte), last byte is the LSB (least significant byte)[just like i2osp, but take an extra parameter for size. if the number is too big to fit in Qlen bytes, nothing is returned otherwise the number is padded with 0 to fit the  len required.|just like i2ospOf except that it doesn't expect a failure: i.e. an integer larger than the number of output bytes requestedhfor example if you just took a modulo of the number that represent the size (example the RSA modulo n). BSD-style#Vincent Hanquez <vincent@snarc.org> experimentalGoodNone2Get some entropy from the system source of entropy BSD-style#Vincent Hanquez <vincent@snarc.org> experimentalGoodNonefPool of Entropy. contains a self mutating pool of entropy, that is always guarantee to contains data. ,Create a new entropy pool of a specific sizeeWhile you can create as many entropy pool as you want, the pool can be shared between multiples RNGs.!.Create a new entropy pool with a default size.eWhile you can create as many entropy pool as you want, the pool can be shared between multiples RNGs.-Put a chunk of the entropy pool into a buffer".Grab a chunk of entropy from the entropy pool. !" !"! " !"? BSD-style#Vincent Hanquez <vincent@snarc.org>Stable ExcellentNone=Chunk some input byte array into @sz byte list of byte array.@ BSD-style#Vincent Hanquez <vincent@snarc.org> experimentalunknownSafe,$#h  BSD-style#Vincent Hanquez <vincent@snarc.org>stablegoodNoneC#<ChaCha context for DRG purpose (see Crypto.Random.ChaChaDRG)$ChaCha context%]Initialize a new ChaCha context with the number of rounds, the key and the nonce associated.&Initialize simple ChaCha State'qCombine the chacha output and an arbitrary message with a xor, and return the combined output and the new state.(:Generate a number of bytes from the ChaCha output directly) similar to ( but assume certains values#$%number of rounds (8,12,20)the key (128 or 256 bits)the nonce (64 or 96 bits)the initial ChaCha state&a 40 bytes long seed'the current ChaCha state$the source to xor with the generator(the current ChaCha statethe length of data to generate)#$%&'()%'($&)# #$%&'()  BSD-style#Vincent Hanquez <vincent@snarc.org>stableGoodNoneC*The encryption state for RC4%C Call for initializing the encryptor+RC4 context initialization.gseed the context with an initial key. the key size need to be adequate otherwise security takes a hit.,Pgenerate the next len bytes of the rc4 stream without combining it to anything.-3RC4 xor combination of the rc4 stream with an input*Pointer to the permutationPointer to the clear textLength of the clear text Output buffer The rc4 keyThe key length The context+The key%The RC4 context with the key mixed in,- rc4 contextinputnew rc4 context, and the output*+,-+-,**+,-  BSD-style#Vincent Hanquez <vincent@snarc.org>stablegoodNoneC. Salsa context/\Initialize a new Salsa context with the number of rounds, the key and the nonce associated.0pCombine the salsa output and an arbitrary message with a xor, and return the combined output and the new state.19Generate a number of bytes from the Salsa output directly./number of rounds (8,12,20)the key (128 or 256 bits)the nonce (64 or 96 bits)the initial Salsa state0the current Salsa state$the source to xor with the generator1the current Salsa statethe length of data to generate./01/01../01  BSD-style#Vincent Hanquez <vincent@snarc.org> experimentalGoodNone2OA simple Monad class very similar to a State Monad with the state being a DRG.3,A Deterministic Random Generator (DRG) class4)Generate N bytes of randomness from a DRG57A monad constraint that allows to generate random bytes7ERun a pure computation with a Deterministic Random Generator in the 2 234567234567562347 234567A BSD-style#Vincent Hanquez <vincent@snarc.org>stableGoodSafe+8BA simple Either like type to represent a computation that can fail2 possibles values are:9H : The computation succeeded, and contains the result of the computation:J : The computation failed, and contains the cryptographic error associated;DEnumeration of all possible errors that can be found in this libraryB^Throw an CryptoError as exception on CryptoFailed result, otherwise return the computed valueCSame as B$ but throw the error asynchronously.DSimple ( like combinator for CryptoFailable typeE'Transform a CryptoFailable to an EitherF%Transform a CryptoFailable to a Maybe89:;<=>?@ABCDEF89:;<=>?@ABCDEF 89:;<=>?@ABCDEF BSD-style"Danny Navarro <j@dannynavarro.net> experimentalGoodNoneG+Binary Polynomial represented by an integerH.Addition over F m. This is just a synonym of .IABinary polynomial reduction modulo using long division algorithm.JMultiplication over F m.n1 * n2 (in F(2^m))K4Squaring over F m. TODO: This is still slower than mulF2m.L<Inversion of @n over F m using extended Euclidean algorithm.3If @n doesn't have an inverse, Nothing is returned.MGDivision over F m. If the dividend doesn't have an inverse it returns .Compute n1 / n2GHIIrreducible binary polynomialJIrreducible binary polynomialKIrreducible binary polynomialLIrreducible binary polynomialMIrreducible binary polynomialDividendQuotientGHIJKLMGHJKILMGHIJKLM BSD-style#Vincent Hanquez <vincent@snarc.org> experimentalGoodNoneN(Top bits policy when generating a numberOset the highest bitPset the two highest bitQUGenerate a number for a specific size of bits, and optionaly set bottom and top bitsIf the top bit policy is T, then nothing is done on the highest bit (it's whatever the random generator set).If @generateOdd is set to `, then the number generated is guaranteed to be odd. Otherwise it will be whatever is generatedR2Generate a positive integer x, s.t. 0 <= x < rangeS9generate a number between the inclusive bound [low,high].NOPQnumber of bitstop bit policyforce the number to be oddRrangeSNOPQRSNOPQRSNOPQRSB BSD-style#Vincent Hanquez <vincent@snarc.org> experimentalunknownNoneC T.Represent a digest for a given hash algorithm.U/Represent a context for a given hash algorithm.V&Class representing hashing algorithms.The interface presented here is update in place and lowlevel. the Hash module takes care of hidding the mutable interface properly.W&Get the block size of a hash algorithmX'Get the digest size of a hash algorithmY5Get the size of the context used for a hash algorithmZEInitialize a context pointer to the initial state of a hash algorithm[%Update the context with some raw data\EFinalize the context and set the digest raw memory to the right value TUVWXYZ[\ TUVWXYZ[\TUVWXYZ[\ BSD-style#Vincent Hanquez <vincent@snarc.org> experimentalunknownNoneC]A Mutable hash context^"Create a new mutable hash context.Jthe algorithm used is automatically determined from the return constraint._"Create a new mutable hash context.0The algorithm is explicitely passed as parameter`&Update a mutable hash context in placea4Finalize a mutable hash context and compute a digestb:Reset the mutable context to the initial state of the hash] ^_`ab VWXYZ[\]^_`ab VWXYZ[\]^_`ab] ^_`abC BSD-style#Vincent Hanquez <vincent@snarc.org> experimentalunknownNonec MD2 cryptographic hash algorithmcd    cdcd    D BSD-style#Vincent Hanquez <vincent@snarc.org> experimentalunknownNonee MD4 cryptographic hash algorithmefefefE BSD-style#Vincent Hanquez <vincent@snarc.org> experimentalunknownNoneg MD5 cryptographic hash algorithmghghghF BSD-style#Vincent Hanquez <vincent@snarc.org> experimentalunknownNonei!SHA1 cryptographic hash algorithmijijijG BSD-style#Vincent Hanquez <vincent@snarc.org> experimentalunknownNonek#SHA224 cryptographic hash algorithmklklklH BSD-style#Vincent Hanquez <vincent@snarc.org> experimentalunknownNonem#SHA256 cryptographic hash algorithmmn !mnmn !I BSD-style#Vincent Hanquez <vincent@snarc.org> experimentalunknownNoneo#SHA384 cryptographic hash algorithmop"#$%opop"#$%J BSD-style#Vincent Hanquez <vincent@snarc.org> experimentalunknownNoneq#SHA512 cryptographic hash algorithmqr&'()qrqr&'()K BSD-style#Vincent Hanquez <vincent@snarc.org> experimentalunknownNones/SHA512t (256 bits) cryptographic hash algorithmu/SHA512t (224 bits) cryptographic hash algorithm stuv*+,-.stuvstuv*+,-.L BSD-style#Vincent Hanquez <vincent@snarc.org> experimentalunknownNonew,SHA3 (512 bits) cryptographic hash algorithmy,SHA3 (384 bits) cryptographic hash algorithm{,SHA3 (256 bits) cryptographic hash algorithm},SHA3 (224 bits) cryptographic hash algorithmwxyz{|}~/012345wxyz{|}~ wxyz{|}~/012345M BSD-style#Vincent Hanquez <vincent@snarc.org> experimentalunknownNone.Kekkak (512 bits) cryptographic hash algorithm.Kekkak (384 bits) cryptographic hash algorithm.Kekkak (256 bits) cryptographic hash algorithm.Kekkak (224 bits) cryptographic hash algorithm6789:;< 6789:;<N BSD-style#Vincent Hanquez <vincent@snarc.org> experimentalunknownNone&RIPEMD160 cryptographic hash algorithm=>?@=>?@O BSD-style#Vincent Hanquez <vincent@snarc.org> experimentalunknownNone"Tiger cryptographic hash algorithmABCDABCDP BSD-style#Vincent Hanquez <vincent@snarc.org> experimentalunknownNone0Skein256 (256 bits) cryptographic hash algorithm0Skein256 (224 bits) cryptographic hash algorithm EFGHIEFGHIQ BSD-style#Vincent Hanquez <vincent@snarc.org> experimentalunknownNone0Skein512 (512 bits) cryptographic hash algorithm0Skein512 (384 bits) cryptographic hash algorithm0Skein512 (256 bits) cryptographic hash algorithm0Skein512 (224 bits) cryptographic hash algorithmJKLMNOP JKLMNOPR BSD-style#Vincent Hanquez <vincent@snarc.org> experimentalunknownNone&Whirlpool cryptographic hash algorithmQRSTQRST BSD-style#Vincent Hanquez <vincent@snarc.org> experimentalunknownNone7Vcdefghijklmnopqrstuvwxyz{|}~7Vcdefghijklmnopqruvst}~{|yzwx BSD-style#Vincent Hanquez <vincent@snarc.org> experimentalunknownNone 'Hash a strict bytestring into a digest.%Hash a lazy bytestring into a digest.0Initialize a new context for this hash algorithmHrun hashUpdates on one single bytestring and return the updated context.`Update the context with a list of strict bytestring, and return a new context with the updates.'Finalize a context and return a digest.7Initialize a new context for a specified hash algorithmRun the 8 function but takes an explicit hash algorithm parameterATry to transform a bytearray into a Digest of specific algorithm.[If the digest is not the right size for the algorithm specified, then Nothing is returned. DTUVWXcdefghijklmnopqrstuvwxyz{|}~ UT  BSD-style#Vincent Hanquez <vincent@snarc.org> experimentalunknownNoneNMSplit data to diffused data, using a random generator and an hash algorithm.the diffused data will consist of random data for (expandTimes-1) then the last block will be xor of the accumulated random data diffused by the hash algorithm. ---------orig - ---------#--------- ---------- --------------"rand1 - - rand2 - - orig ^ acc -#--------- ---------- --------------9where acc is : acc(n+1) = hash (n ++ rand(n)) ^ acc(n)9Merge previously diffused data back to the original data.U%inplace Xor with an input dst = src  dst!Hash algorithm to use as diffuserRandom generator to use$Number of times to diffuse the data.original data to diffuse.The diffused dataHash algorithm used as diffuser&Number of times to un-diffuse the data Diffused data Original dataUV Hash function to use as diffuser"buffer to diffuse, modify in placelength of buffer to diffuseUV BSD-style#Vincent Hanquez <vincent@snarc.org> experimentalunknownNoneC;Represent an ongoing HMAC state, that can be appended with  and finalize to an HMAC with  hmacFinalizeORepresent an HMAC that is a phantom type with the hash used to produce the mac.!The Eq instance is constant time.1compute a MAC using the supplied hashing function)Initialize a new incremental HMAC context#Incrementally update a HMAC context9Increamentally update a HMAC context with multiple inputs,Finalize a HMAC context and return the HMAC.  Secret keyMessage to MAC Secret keyCurrent HMAC contextMessage to append to the MACUpdated HMAC contextCurrent HMAC contextMessages to append to the MACUpdated HMAC contextW W BSD-style#Vincent Hanquez <vincent@snarc.org> experimentalunknownNoneParameters for PBKDF2Nthe number of user-defined iterations for the algorithms. e.g. WPA2 uses 4000.-the number of bytes to generate out of PBKDF2The PRF used for PBKDF2>PRF for PBKDF2 using HMAC with the hash algorithm as parameter;generate the pbkdf2 key derivation function from the outputthe password parameters the contentprf(password,content) BSD-style#Vincent Hanquez <vincent@snarc.org> experimentalunknownNoneParameters for ScryptLCpu/Memory cost ratio. must be a power of 2 greater than 1. also known as N.Must satisfy r * p < 2^30Must satisfy r * p < 2^30-the number of bytes to generate out of Scrypt'Generate the scrypt key derivation dataXX BSD-style#Vincent Hanquez <vincent@snarc.org> experimentalGoodNone%Represent a mask generation algorithmMask generation algorithm MGF1seedlength to generate BSD-style#Vincent Hanquez <vincent@snarc.org> experimentalunknownNone<CMA Curve25519 Diffie Hellman secret related to a public key and a secret key.A Curve25519 public keyA Curve25519 Secret key*Try to build a public key from a bytearray*Try to build a secret key from a bytearray)Create a DhSecret from a bytearray objectDCompute the Diffie Hellman secret from a public key and a secret key%Create a public key from a secret key YZ[\publicsecret basepoint YZ[\ BSD-style#Vincent Hanquez <vincent@snarc.org> experimentalGoodNone+Represent a DSA key pairRepresent a DSA private key.VOnly x need to be secret. the DSA parameters are publicly shared with the other side.DSA parameters DSA private XRepresent a DSA public key.DSA parameters DSA public Y)Represent a DSA signature namely R and S.DSA rDSA s,Represent DSA parameters namely P, G, and Q.DSA pDSA gDSA q7DSA Private Number, usually embedded in DSA Private Key5DSA Public Number, usually embedded in DSA Public KeyPublic key of a DSA Key pairPrivate key of a DSA Key pairagenerate a private number with no specific property this number is usually called X in DSA text.CCalculate the public number from the parameters and the private key<sign message using the private key and an explicit k number.#sign message using the private key.)verify a bytestring using the public key.!k random number private key hash functionmessage to sign]^_`a]^_`a BSD-style#Vincent Hanquez <vincent@snarc.org> Experimental ExcellentSafe+*Define names for known recommended curves.PDefine common parameters in a curve definition of the form: y^2 = x^3 + ax + b.curve parameter acurve parameter b base point  order of G cofactor IDefine an elliptic curve in =p. The first parameter is the Prime Number. zDefine an elliptic curve in =(2^m). The firt parameter is the Integer representatioin of the irreducible polynomial f(x).Define a point on a curve.Point at InfinityECC Private NumberECC Public Point.Define either a binary curve or a prime curve.=(2^m)=p5Parameters in common between binary and prime curves.HIrreducible polynomial representing the characteristic of a CurveBinary.=Prime number representing the characteristic of a CurvePrime.HGet the curve definition associated with a recommended known curve name.;     bc9     9     !     bcNoneElliptic Curve point addition.WARNING: Vulnerable to timing attacks.Elliptic Curve point doubling.WARNING: Vulnerable to timing attacks.This perform the following calculation: > lambda = (3 * xp ^ 2 + a) / 2 yp > xr = lambda ^ 2 - 2 xp > yr = lambda (xp - xr) - ypWith binary curve: > xp == 0 => P = O > otherwise => > s = xp + (yp / xp) > xr = s ^ 2 + s + a > yr = xp ^ 2 + (s+1) * xr?Elliptic curve point multiplication (double and add algorithm).WARNING: Vulnerable to timing attacks.*Check if a point is the point at infinity.%check if a point is on specific curveThis perform three checks:x is not out of rangey is not out of range the equation y^2 = x^3 + a*x + b (mod p) holdsd div and modddNone+  ECDSA Key Pair."ECDSA Public Key.&ECDSA Private Key.*+Represent a ECDSA signature namely R and S.,ECDSA r-ECDSA s.Public key of a ECDSA Key pair./ Private key of a ECDSA Key pair.0<Sign message using the private key and an explicit k number.WARNING: Vulnerable to timing attacks.1#Sign message using the private key.WARNING: Vulnerable to timing attacks.2)Verify a bytestring using the public key.eTruncate and hash. !"#$%&'()*+,-./0k random number private key hash functionmessage to sign12e !"#$%&'()*+,-./012*+,-"#$%&'() !./012  !"#$%&'()*+,-./012eNone3Generate Q given d.WARNING: Vulnerable to timing attacks.4)Generate a pair of (private, public) key.WARNING: Vulnerable to timing attacks.34Elliptic Curve343434 BSD-style#Vincent Hanquez <vincent@snarc.org> experimentalGoodNone+C5Represent RSA KeyPairRnote the RSA private key contains already an instance of public key for efficiency7Represent a RSA private key.-Only the pub, d fields are mandatory to fill.p, q, dP, dQ, qinv are by-product during RSA generation, but are useful to record here to speed up massively the decrypt and sign operation./implementations can leave optional fields to 0.9,public part of a private key (size, n and e):private exponant d;p prime number<q prime number= d mod (p-1)> d mod (q-1)? q^(-1) mod p@Represent a RSA public keyBsize of key in bytesC public p*qDpublic exponant eE8error possible during encryption, decryption or signing.FNthe message to decrypt is not of the correct size (need to be == private_size)G"the message to encrypt is too longHDthe message decrypted doesn't have a PKCS15 structure (0 2 .. 0 msg)I the message's digest is too longJ-some parameters lead to breaking assumptions.KlBlinder which is used to obfuscate the timing of the decryption primitive (used by decryption and signing).M(get the size in bytes from a private keyNget n from a private keyOget e from a private keyPPublic key of a RSA KeyPairQPrivate key of a RSA KeyPair56789:;<=>?@ABCDEFGHIJKLMNOPQfg56789:;<=>?@ABCDEFGHIJKLMNOPQEFGHIJKL@ABCD789:;<=>?56PQMNO 56789:;<=>?@ABCDEFGHIJKLMNOPQfg BSD-style#Vincent Hanquez <vincent@snarc.org> experimentalGoodNoneRCompute the RSA decrypt primitive. if the p and q numbers are available, then dpFast is used otherwise, we use dpSlow which only need d and n.S!Compute the RSA encrypt primitivehKmultiply 2 integers in Zm only performing the modulo operation if necessaryijkRShRSRSijkRShS BSD-style#Vincent Hanquez <vincent@snarc.org>stablegoodNoneCT%ChaCha Deterministic Random Generatorl]Initialize a new ChaCha context with the number of rounds, the key and the nonce associated.mInitialize a new ChaCha context from 5-tuple of words64. This interface is useful when creating a RNG out of tests generators (e.g. QuickCheck).Tnl40 bytes of seedthe initial ChaCha statemopTlmTnlmopT BSD-style#Vincent Hanquez <vincent@snarc.org> experimentalGoodNoneU]A referentially transparent System representation of the random evaluated out of the system.fHolding onto a specific DRG means that all the already evaluated bytes will be consistently replayed.NThere's no need to reseed this DRG, as only pure entropy is represented here.V#Grab one instance of the System DRGUqrVstUVUqrVst  BSD-style#Vincent Hanquez <vincent@snarc.org>stablegoodNoneW$Create a new DRG from system entropyXCreate a new DRG from 5 Word64._This is a convenient interface to create deterministic interface for quickcheck style testing._It can also be used in other contexts provided the input has been properly randomly generated.Y Generate 6len random bytes and mapped the bytes to the function f.(This is equivalent to use Control.Arrow  with 4WXY 234567TUVWXY TUVWX7Y34562WXYU BSD-style#Vincent Hanquez <vincent@snarc.org> experimentalGoodNoneuThis create a random number generator out of thin air with the system entropy; don't generally use as the IO is not exposed this can have unexpected random for.This is useful for probabilistic algorithm like Miller Rabin probably prime algorithm, given appropriate choice of the heuristic0Generally, it's advise not to use this function.uuu! BSD-style#Vincent Hanquez <vincent@snarc.org> experimentalGoodNone Zreturns if the number is probably prime. first a list of small primes are implicitely tested for divisibility, then a fermat primality test is used with arbitrary numbers and then the Miller Rabin algorithm is used with an accuracy of 30 recursions[/generate a prime number of the required bitsize\|generate a prime number of the form 2p+1 where p is also prime. it is also knowed as a Sophie Germaine prime or safe prime.The number of safe prime is significantly smaller to the number of prime, as such it shouldn't be used if this number is supposed to be kept safe.];find a prime from a starting point where the property hold.^=find a prime from a starting point with no specific property._Miller Rabin algorithm return if the number is probably prime or composite. the tries parameter is the number of recursion, that determines the accuracy of the test.`Probabilitic Test using Fermat primility test. Beware of Carmichael numbers that are Fermat liars, i.e. this test is useless for them. always combines with some other test.aeTest naively is integer is prime. while naive, we skip even number and stop iteration at i > sqrt(n)b-Test is two integer are coprime to each otherv$list of the first primes till 2903.. Z[\]^_`%number of iterations of the algorithm starting anumber to test for primalityabvw Z[\]^_`ab [\Z^]_a`b Z[\]^_`abvw" BSD-style#Vincent Hanquez <vincent@snarc.org> experimentalGoodNone+C c'Represent Diffie Hellman shared secret.e*Represent Diffie Hellman private number X.g)Represent Diffie Hellman public number Y.iHRepresent Diffie Hellman parameters namely P (prime), and G (generator).mgenerate params from a specific generator (2 or 5 are common values) we generate a safe prime (a prime number of the form 2p+1 where p is also prime)n`generate a private number with no specific property this number is usually called X in DH text.opcalculate the public number from the parameters and the private key this number is usually called Y in DH text.ppcalculate the public number from the parameters and the private key this number is usually called Y in DH text.DEPRECATED use calculatePublicqPgenerate a shared key using our private number and the other party public numbercdefghijklmnopqcdefghijklmnopqijklghefcdmnopq cdefghijklmnopq# BSD-style#Vincent Hanquez <vincent@snarc.org> experimentalunknownNonerGenerating a private number d.sGenerating a public point Q.tUGenerating a shared key using our private number and the other party public point.rstcdrstcdrstrst$ BSD-style#Vincent Hanquez <vincent@snarc.org> experimentalGoodNoneu"Generate a key pair given p and q.*p and q need to be distinct prime numbers.e need to be coprime to phi=(p-1)*(q-1). If that's not the case, the function will not return a key pair. A small hamming weight results in better performance.e=0x10001 is a popular choiceFe=3 is popular as well, but proven to not be as secure for some cases.v:generate a pair of (private, public) key of size in bytes.w?Generate a blinder to use with decryption and signing operationWthe unique parameter apart from the random number generator is the public key value N.uchosen distinct primes p and q size in bytesRSA public exponant ev size in bytesRSA public exponant ewRSA public N parameter.789:;<=>?@ABCDEFGHIJKLuvwEFGHIJ@ABCD789:;<=>?KLuvwuvw% BSD-style#Vincent Hanquez <vincent@snarc.org> experimentalGoodNone xA specialized class for hash algorithm that can product a ASN1 wrapped description the algorithm plus the content of the digest.y6This produce a standard PKCS1.5 padding for encryptionz0Produce a standard PKCS1.5 padding for signature{4Try to remove a standard PKCS1.5 encryption padding.|&decrypt message using the private key.When the decryption is not in a context where an attacker could gain information from the timing of the operation, the blinder can be set to None.2If unsure always set a blinder or use decryptSafer}Pdecrypt message using the private key and by automatically generating a blinder.~*encrypt a bytestring using the public key.6the message needs to be smaller than the key size - 11?sign message using private key, a hash and its ASN1 descriptionWhen the signature is not in a context where an attacker could gain information from the timing of the operation, the blinder can be set to None./If unsure always set a blinder or use signSaferMsign message using the private key and by automatically generating a blinder.&verify message with the signed messagexmake signature digest, used in  and xyzyz{|optional blinderRSA private key cipher text}RSA private key cipher text~optional blinderhash algorithm private keymessage to signHash algorithm private keymessage to signxoptional hashing algorithm{|}~ xyz{|}~ yz{|}~xxyzyz{|}~x{|}~& BSD-style#Vincent Hanquez <vincent@snarc.org> experimentalGoodNone *Parameters for PSS signature/verification.Hash function to useMask Gen algorithm to use&Length of salt. need to be <= to hLen.Trailer field, usually 0xbc-Default Params with a specified hash function$Default Params using SHA1 algorithm.LSign using the PSS parameters and the salt explicitely passed as parameters.6the function ignore SaltLength from the PSS ParametersSign using the PSS ParametersESign using the PSS Parameters and an automatically generated blinder.+Verify a signature using the PSS Parameters  Salt to useoptional blinder to usePSS Parameters to useRSA Private KeyMessage to signoptional blinder to usePSS Parameters to useRSA Private KeyMessage to signPSS Parameters to use private keymessage to sign\PSS Parameters to use to verify, this need to be identical to the parameters when signingRSA Public KeyMessage to verify Signature  ' BSD-style#Vincent Hanquez <vincent@snarc.org> experimentalGoodNone )Parameters for OAEP encryption/decryptionHash function to use.Mask Gen algorithm to use.$Optional label prepended to message.-Default Params with a specified hash function4Encrypt a message using OAEP with a predefined seed.Encrypt a message using OAEPun-pad a OAEP encoded message.-It doesn't apply the RSA decryption primitiveDecrypt a ciphertext using OAEPWhen the signature is not in a context where an attacker could gain information from the timing of the operation, the blinder can be set to None.2If unsure always set a blinder or use decryptSaferJDecrypt a ciphertext using OAEP and by automatically generating a blinder. Seed!OAEP params to use for encryption Public key.Message to encrypt"OAEP params to use for encryption. Public key.Message to encryptOAEP params to usesize of the key in bytesencoded message (not encrypted)Optional blinder!OAEP params to use for decryption Private key Cipher text!OAEP params to use for decryption Private key Cipher text  V BSD-style#Vincent Hanquez <vincent@snarc.org>Stable ExcellentNone)Compute the gfmul with the XTS polynomialblock size need to be 128 bits."FIXME: add support for big endian.W BSD-style#Vincent Hanquez <vincent@snarc.org> experimentalGoodNoneC 1ElGamal Ephemeral key. also called Temporary key.ElGamal Signaturegenerate a private number with no specific property this number is usually called a and need to be between 0 and q (order of the group G).~generate an ephemeral key which is a number with no specific property, and need to be between 0 and q (order of the group G).cgenerate a public number that is for the other party benefits. this number is usually called h=g^aCencrypt with a specified ephemeral key do not reuse ephemeral key.Zencrypt a message using params and public keys will generate b (called the ephemeral key)decrypt message(sign a message with an explicit k number7if k is not appropriate, then no signature is returned.with some appropriate value of k, the signature generation can fail, and no signature is returned. User of this function need to retry with a different k value. sign messageThis function will generate a random number, however as the signature might fail, the function will automatically retry until a proper signature has been created.verify a signature 3random number k, between 0 and p-1 and gcd(k,p-1)=1DH params (p,g)DH private key"collision resistant hash algorithmmessage to signDH params (p,g)DH private key"collision resistant hash algorithmmessage to signcegi   BSD-style#Vincent Hanquez <vincent@snarc.org>Stable ExcellentSafe89:;<=>?@ABCDEF;<=>?@A89:BCDEFX BSD-style experimentalGoodNonevariable keyed blowfish stateEncrypt blocks&Input need to be a multiple of 8 bytesDecrypt blocks&Input need to be a multiple of 8 bytes-Initialize a new Blowfish context from a key.%key need to be between 0 to 448 bits.  Y BSD-style#Vincent Hanquez <vincent@snarc.org> experimentalGoodNone<Camellia contextInitialize a 128-bit key`Return the initialized key or a error message if the given keyseed was not 16-bytes in length.1Encrypts the given ByteString using the given Key1Decrypts the given ByteString using the given Key%&The key to create the camellia contextThe key to useThe data to encryptThe key to useThe data to decrypt( BSD-style#Vincent Hanquez <vincent@snarc.org>stablegoodNone6Nonce smart constructor 12 bytes IV, nonce constructor8 bytes IV, nonce constructor 4 bytes constant  8 bytes IV   Z BSD-style#Vincent Hanquez <vincent@snarc.org>Stable ExcellentNone;CN Symmetric cipher class.&Initialize a cipher context from a key Cipher nameYreturn the size of the key required for this cipher. Some cipher accept any size for key AEAD Mode%Authentication Tag for AE cipher mode7Offset inside an XTS data unit, measured in block size.)Different specifier for key size in bytesin the range [min,max]one of the specified valuesa specific size[ BSD-style#Vincent Hanquez <vincent@snarc.org>Stable ExcellentNone;IN8Authenticated Encryption with Associated Data algorithmsAEAD Implementation1Append some header information to an AEAD context-Encrypt some data and update the AEAD context-Decrypt some data and update the AEAD context;Finalize the AEAD context and return the authentication tagSimple AEAD encryptionSimple AEAD decryptionA new AEAD Context#Optional Authentication data headerOptional Plaintext Tag length!Authentication tag and ciphertextA new AEAD Context#Optional Authentication data header CiphertextThe authentication tag Plaintext\ BSD-style#Vincent Hanquez <vincent@snarc.org>Stable ExcellentNone 7;IN0class of block cipher with a 128 bits block sizeencrypt using the XTS mode.ainput need to be a multiple of the blocksize, and the cipher need to process 128 bits block onlydecrypt using the XTS mode.ainput need to be a multiple of the blocksize, and the cipher need to process 128 bits block onlySymmetric block cipher class7Return the size of block required for this block cipherEncrypt blocks6the input string need to be multiple of the block sizeDecrypt blocks6the input string need to be multiple of the block sizeencrypt using the CBC mode.,input need to be a multiple of the blocksizedecrypt using the CBC mode.,input need to be a multiple of the blocksizeencrypt using the CFB mode.,input need to be a multiple of the blocksizedecrypt using the CFB mode.,input need to be a multiple of the blocksizecombine using the CTR mode.hCTR mode produce a stream of randomized data that is combined (by XOR operation) with the input stream.1encryption and decryption are the same operation.input can be of any sizeInitialize a new AEAD State:When Nothing is returns, it means the mode is not handled. XTS callback an IV parametrized by the cipher)Create an IV for a specified block cipher:Create an IV that is effectively representing the number 0Increment an IV by a number.&Assume the IV is in Big Endian format.2Usually represent the Data Unit (e.g. disk sector)+Offset in the data unit in number of blocks Plaintext Ciphertext2Usually represent the Data Unit (e.g. disk sector)+Offset in the data unit in number of blocks Ciphertext Plaintext2Usually represent the Data Unit (e.g. disk sector)+Offset in the data unit in number of blocksDataProcessed Data! ] BSD-style#Vincent Hanquez <vincent@snarc.org>Stable ExcellentNoneSymmetric stream cipher classCombine using the stream cipher) BSD-style#Vincent Hanquez <vincent@snarc.org>Stable ExcellentNone+55^ BSD-style#Vincent Hanquez <vincent@snarc.org>stablegoodNone C AESOCB State AESGCM StateAES Context (pre-processed key))Create an AES AEAD implementation for GCM)Create an AES AEAD implementation for OCB#Initialize a new context with a keyRKey needs to be of length 16, 24 or 32 bytes. Any other values will return failure(encrypt using Electronic Code Book (ECB))encrypt using Cipher Block Chaining (CBC)vgenerate a counter mode pad. this is generally xor-ed to an input to make the standard counter mode block operations.if the length requested is not a multiple of the block cipher size, more data will be returned, so that the returned bytearray is a multiple of the block cipher size.vgenerate a counter mode pad. this is generally xor-ed to an input to make the standard counter mode block operations.if the length requested is not a multiple of the block cipher size, more data will be returned, so that the returned bytearray is a multiple of the block cipher size. Similiar to - but also return the next IV for continuation encrypt using Counter mode (CTR)<in CTR mode encryption and decryption is the same operation.encrypt using XTSdthe first key is the normal block encryption key the second key is used for the initial block tweak(decrypt using Electronic Code Book (ECB))decrypt using Cipher block chaining (CBC)!decrypt using Counter mode (CTR).<in CTR mode encryption and decryption is the same operation.decrypt using XTSinitialize a gcm contextGappend data which is only going to be authenticated to the GCM context.Uneeds to happen after initialization and before appending encryption/decryption data.4append data to encrypt and append to the GCM contextthe bytearray needs to be a multiple of AES block size, unless it's the last call to this function. needs to happen after AAD appending, or after initialization if no AAD data.4append data to decrypt and append to the GCM contextthe bytearray needs to be a multiple of AES block size, unless it's the last call to this function. needs to happen after AAD appending, or after initialization if no AAD data.!Generate the Tag from GCM contextinitialize an ocb contextGappend data which is going to just be authenticated to the OCB context.Tneed to happen after initialization and before appending encryption/decryption data.4append data to encrypt and append to the OCB contextthe bytearray needs to be a multiple of the AES block size, unless it's the last call to this function. need to happen after AAD appending, or after initialization if no AAD data.4append data to decrypt and append to the OCB contextthe bytearray needs to be a multiple of the AES block size, unless it's the last call to this function. need to happen after AAD appending, or after initialization if no AAD data.!Generate the Tag from OCB contextA      AES Context Initial vector of AES block size plaintext ciphertext Cipher Key.usually a 128 bit integer.length of bytes required. AES ContextIinitial vector of AES block size (usually representing a 128 bit integer)plaintext inputciphertext outputAES cipher and tweak context:a 128 bits IV, typically a sector or a block offset in XTSLnumber of rounds to skip, also seen a 16 byte offset in the sector or block.input to encryptoutput encrypted AES Context6initial vector, usually representing a 128 bit integerciphertext inputplaintext outputAES cipher and tweak context:a 128 bits IV, typically a sector or a block offset in XTSLnumber of rounds to skip, also seen a 16 byte offset in the sector or block.input to decryptoutput decrypted>     * BSD-style#Vincent Hanquez <vincent@snarc.org>stablegoodNoneC448 bit keyed blowfish state256 bit keyed blowfish state128 bit keyed blowfish state64 bit keyed blowfish statevariable keyed blowfish state !"# !"#+ BSD-style#Vincent Hanquez <vincent@snarc.org> experimentalGoodNone&Camellia block cipher with 128 bit key$%&$%&, BSD-style#Vincent Hanquez <vincent@snarc.org>stablegoodNone DES Context'()*'()*- BSD-style experimental???NoneL3DES where the first and third keys are equal, used in alternative directionI3DES where the first and third keys are equal, used in the same direction83DES with 3 different keys used in alternative direction93DES with 3 different keys used all in the same direction+,-./012345678+,-./012345678. BSD-style#Vincent Hanquez <vincent@snarc.org> experimentalunknownNoneC A P256 point A P256 scalarLift to curve a scalar0Using the curve generator as base point compute:  scalar * GAdd a point to another pointMultiply a point by a scalarwarning: variable timemultiply the point p with &n2 and add a lifted to curve value @n1 n1 * G + n2 * pwarning: variable time Check if a  is validThe scalar representing 0$Perform addition between two scalars a + b'Perform subtraction between two scalars a - bGive the inverse of the scalar 1 / awarning: variable timeCompare 2 Scalarconvert a scalar from binaryconvert a scalar to binary:9:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]89:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]/ BSD-style#Vincent Hanquez <vincent@snarc.org> experimentalunknownNoneC An Ed25519 signatureAn Ed25519 public keyAn Ed25519 Secret key*Try to build a public key from a bytearray*Try to build a secret key from a bytearray)Try to build a signature from a bytearray%Create a public key from a secret key!Sign a message using the key pairVerify a message^_`abcdef  ^_`abcdef0 BSD-style#Vincent Hanquez <vincent@snarc.org>stablegoodNoneCAES with 256 bit keyAES with 192 bit keyAES with 128 bit keyghijklmnopqr ghijklmnopqrs7_7`7abcdefghijklmnoppqrstuvwomnxyz{|} ~ r s  r s r s    AAAAAAAAAAAAAAABBBBBBBBBCCDDEEFFGGHHIIJJKKKKLLLLLLLLMMMMMMMMNNOOPPPPQQQQQQQQRRstuv      !"#$%&''()*+,--..//0123456789:;<=>?@ABCADEFGHIJKLMNOPQRRSTUVWSXTYTZ [ \ ]!^!_!`!a!b!c!d!e!f"g"g""""""""""""h"i###i$j$$k%l%m%n%o%p%q%r%%s%&t&t&u&v&w&x&y&z&{&&s&'|'|'}'~''''r'p'q((r(((s((((vZZZZZZZZZZZZZZZZZZ[[[[[[[[[[[[[[[[\\\\\\\\\\\\\\\\\]]*****+,----./...9.;................/////////0002222233334444444555555555555556677_8899999 9 9 9 9 999999::r:p:::::::::: :!:":#:$:%:&:':(:):*:+:,:-:.:/:0:1:2:3:4:5:6:7:8:9::;;<=><?<@<A<B<C<D<E<F<G<H<I<J<K<L<M<N<?<@<A<B=OPQPRPSPTUVUWUXUYUZU[U\U]^_^`^a^bcdcecfcgchcicjckclcmcncocpcqcrcsctcucvcwcxcyczc{c|c}c~cccrz?} ~ r       r  r          AAAAAA=uBBBCCCCDDDDEEEEFFFFGGGGHHHHIIIIJJJJKKKKKLLLLLLLM M M M M MMNNNNOOOOPPPPPQQQQ Q!Q"Q#R$R%R&R'()*+,-./012345./6789SsS:SXSS;TYT<TT=U>!?!@%A%B%C%D%E%F%G%H%I%J%K%L%M&N'oVOWPWWWQWhWRWrWpWWWWPWXXrXpXSXTXUXVXWXXXYYZY[YrYpYZY\Y]Y^Y_Y`YaYbYcYdYeYfYgYhYiYjYkYlYmYnYoYpYqYrYsYtYuYvYwYxYyYzY{((r(|Z}\~\\\\\\\\\\\^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^***************+++,,,,--------------...../................................/////////0000 0 0 0 0 0000crypt_0c1mXSOfVPe7XhtUYYJbFPCrypto.Random.Entropy.UnsafeCrypto.Number.BasicCrypto.Number.ModArithmetic Crypto.Number.Serialize.InternalCrypto.MAC.Poly1305Crypto.Number.SerializeCrypto.Random.EntropyCrypto.Random.EntropyPoolCrypto.Cipher.ChaChaCrypto.Cipher.RC4Crypto.Cipher.SalsaCrypto.Random.Types Crypto.ErrorCrypto.Number.F2mCrypto.Number.Generate Crypto.HashCrypto.Hash.IOCrypto.Hash.AlgorithmsCrypto.Data.AFISCrypto.MAC.HMACCrypto.KDF.PBKDF2Crypto.KDF.ScryptCrypto.PubKey.MaskGenFunctionCrypto.PubKey.Curve25519Crypto.PubKey.DSACrypto.PubKey.ECC.TypesCrypto.PubKey.ECC.PrimCrypto.PubKey.ECC.ECDSACrypto.PubKey.ECC.GenerateCrypto.PubKey.RSA.TypesCrypto.PubKey.RSA.Prim Crypto.RandomCrypto.Number.PrimeCrypto.PubKey.DHCrypto.PubKey.ECC.DHCrypto.PubKey.RSACrypto.PubKey.RSA.PKCS15Crypto.PubKey.RSA.PSSCrypto.PubKey.RSA.OAEPCrypto.Cipher.ChaChaPoly1305Crypto.Cipher.TypesCrypto.Cipher.BlowfishCrypto.Cipher.CamelliaCrypto.Cipher.DESCrypto.Cipher.TripleDESCrypto.PubKey.ECC.P256Crypto.PubKey.Ed25519Crypto.Cipher.AESCrypto.Internal.DeepSeqCrypto.Internal.CompatPrimCrypto.Random.Entropy.SourceCrypto.Random.Entropy.RDRandCrypto.Random.Entropy.UnixCrypto.Internal.WordsCrypto.Random.Entropy.BackendCrypto.PubKey.InternalCrypto.Number.CompatCrypto.Cipher.DES.PrimitiveCrypto.Internal.CompatCrypto.Internal.WordArrayCrypto.Cipher.Blowfish.BoxCrypto.Internal.ByteArrayCrypto.Cipher.Types.UtilsCrypto.Internal.ImportsCrypto.Error.TypesCrypto.Hash.TypesCrypto.Hash.MD2Crypto.Hash.MD4Crypto.Hash.MD5Crypto.Hash.SHA1Crypto.Hash.SHA224Crypto.Hash.SHA256Crypto.Hash.SHA384Crypto.Hash.SHA512Crypto.Hash.SHA512tCrypto.Hash.SHA3Crypto.Hash.KekkakCrypto.Hash.RIPEMD160Crypto.Hash.TigerCrypto.Hash.Skein256Crypto.Hash.Skein512Crypto.Hash.WhirlpoolCrypto.Random.ChaChaDRGCrypto.Random.SystemDRGCrypto.Random.ProbabilisticCrypto.Cipher.Types.GFCrypto.PubKey.ElGamal Crypto.Cipher.Blowfish.Primitive Crypto.Cipher.Camellia.PrimitiveCrypto.Cipher.Types.BaseCrypto.Cipher.Types.AEADCrypto.Cipher.Types.BlockCrypto.Cipher.Types.StreamCrypto.Cipher.AES.PrimitiveEntropyBackendsupportedBackends gatherBackend replenishsqrtigcdeareEvenlog2numBitsnumBytesexpSafeexpFastinverseinverseCoprimesi2ospi2ospOfos2ipAuthCtxState initializeupdateupdatesfinalizeauthi2ospOf_ getEntropy EntropyPoolcreateEntropyPoolWithcreateEntropyPoolgetEntropyFrom StateSimpleinitializeSimplecombinegenerategenerateSimpleMonadPseudoRandomDRGrandomBytesGenerate MonadRandomgetRandomByteswithDRGCryptoFailable CryptoPassed CryptoFailed CryptoErrorCryptoError_KeySizeInvalidCryptoError_IvSizeInvalid CryptoError_AEADModeNotSupported CryptoError_SecretKeySizeInvalid%CryptoError_SecretKeyStructureInvalid CryptoError_PublicKeySizeInvalidthrowCryptoErrorIOthrowCryptoErroronCryptoFailureeitherCryptoErrormaybeCryptoErrorBinaryPolynomialaddF2mmodF2mmulF2m squareF2minvF2mdivF2m GenTopPolicy SetHighest SetTwoHighestgenerateParams generateMaxgenerateBetweenDigestContext HashAlgorithm hashBlockSizehashDigestSizehashInternalContextSizehashInternalInithashInternalUpdatehashInternalFinalizeMutableContexthashMutableInithashMutableInitWithhashMutableUpdatehashMutableFinalizehashMutableResetMD2MD4MD5SHA1SHA224SHA256SHA384SHA512 SHA512t_256 SHA512t_224SHA3_512SHA3_384SHA3_256SHA3_224 Kekkak_512 Kekkak_384 Kekkak_256 Kekkak_224 RIPEMD160Tiger Skein256_256 Skein256_224 Skein512_512 Skein512_384 Skein512_256 Skein512_224 WhirlpoolhashhashlazyhashInit hashUpdate hashUpdates hashFinalize hashInitWithhashWithdigestFromByteStringsplitmergeHMAC hmacGetDigesthmac Parameters iterCounts outputLengthPRFprfHMACnrpMaskGenAlgorithmmgf1DhSecret PublicKey SecretKey publicKey secretKeydhSecretdhtoPublicKeyPair PrivateKeyprivate_params private_x public_paramspublic_y Signaturesign_rsign_sParamsparams_pparams_gparams_q PrivateNumber PublicNumber toPublicKey toPrivateKeygeneratePrivatecalculatePublicsignWithsignverify CurveName SEC_p112r1 SEC_p112r2 SEC_p128r1 SEC_p128r2 SEC_p160k1 SEC_p160r1 SEC_p160r2 SEC_p192k1 SEC_p192r1 SEC_p224k1 SEC_p224r1 SEC_p256k1 SEC_p256r1 SEC_p384r1 SEC_p521r1 SEC_t113r1 SEC_t113r2 SEC_t131r1 SEC_t131r2 SEC_t163k1 SEC_t163r1 SEC_t163r2 SEC_t193r1 SEC_t193r2 SEC_t233k1 SEC_t233r1 SEC_t239k1 SEC_t283k1 SEC_t283r1 SEC_t409k1 SEC_t409r1 SEC_t571k1 SEC_t571r1 CurveCommonecc_aecc_becc_gecc_necc_h CurvePrime CurveBinaryPointPointO PublicPointCurveCurveF2mCurveFP common_curveecc_fxecc_pgetCurveByNamepointAdd pointDoublepointMulisPointAtInfinity isPointValid public_curvepublic_q private_curve private_d generateQ private_pub private_p private_q private_dP private_dQ private_qinv public_sizepublic_npublic_eErrorMessageSizeIncorrectMessageTooLongMessageNotRecognizedSignatureTooLongInvalidParametersBlinder private_size private_n private_edpep ChaChaDRG SystemDRG getSystemDRGdrgNew drgNewTestwithRandomBytesisProbablyPrime generatePrimegenerateSafePrimefindPrimeFromWith findPrimeFromprimalityTestMillerRabinprimalityTestFermatprimalityTestNaive isCoprime SharedKeygeneratePublic getShared generateWithgenerateBlinderHashAlgorithmASN1pad padSignatureunpaddecrypt decryptSaferencrypt signSafer PSSParamspssHash pssMaskGenAlg pssSaltLengthpssTrailerFielddefaultPSSParamsdefaultPSSParamsSHA1 signWithSalt OAEPParamsoaepHashoaepMaskGenAlg oaepLabeldefaultOAEPParamsencryptWithSeedNoncenonce12nonce8 appendAAD finalizeAADCipher cipherInit cipherName cipherKeySizeAEADModeAEAD_OCBAEAD_CCMAEAD_EAXAEAD_CWCAEAD_GCMAuthTag unAuthTagDataUnitOffsetKeySizeSpecifier KeySizeRange KeySizeEnum KeySizeFixedAEAD aeadModeImpl aeadState AEADModeImplaeadImplAppendHeaderaeadImplEncryptaeadImplDecryptaeadImplFinalizeaeadAppendHeader aeadEncrypt aeadDecrypt aeadFinalizeaeadSimpleEncryptaeadSimpleDecryptBlockCipher128 xtsEncrypt xtsDecrypt BlockCipher blockSize ecbEncrypt ecbDecrypt cbcEncrypt cbcDecrypt cfbEncrypt cfbDecrypt ctrCombineaeadInitIVmakeIVnullIVivAdd StreamCipher streamCombine Blowfish448 Blowfish256 Blowfish128 Blowfish64Blowfish Camellia128DESDES_EDE2DES_EEE2DES_EDE3DES_EEE3ScalartoPointpointsMulVarTime pointIsValidpointToIntegerspointFromIntegers pointToBinarypointFromBinary scalarZero scalarIsZero scalarAdd scalarSub scalarInv scalarCmpscalarFromBinaryscalarToBinaryscalarFromIntegerscalarToInteger signatureAES256AES192AES128deeps_LbCWUlehDDeLxurARKDH5oControl.DeepSeqrnfNFDatabe32Primle32Primbyteswap32Prim convert4To32 booleanPrim EntropySource entropyOpen entropyGather entropyCloseRDRandc_get_rand_bytesc_cpu_has_rdrand rdrandGrabrdrandGetBytes$fEntropySourceRDRand DevURandom DevRandom DeviceNameHtestOpenopenDevwithDevcloseDevgatherDevEntropygatherDevEntropyNonBlock$fEntropySourceDevURandom$fEntropySourceDevRandomw64to32baseGHC.WordWord64Word32w32to64memor_JREhiXyVoWvD3PjsXYOmPCData.Memory.ExtendedWordsWord128 openBackendand'&&! GmpSupportedonGmpUnsupportedgmpGcdegmpLog2gmpPowModSecIntegergmpPowModInteger gmpInverse gmpNextPrimegmpTestPrimeMillerRabingmpSizeInBytesgmpExportIntegergmpImportIntegerGmpUnsupported gmpSizeInBitsCoprimesAssertionErrorexponentiation!$fExceptionCoprimesAssertionErrorfillPtrBlockBits64Bits56Bits48Bits32Bits6Bits4KeyRotationunBlockdesXor desRotatebitifyunbitifyinitial_permutationkey_transformationdes_encdes_decdo_desdes_workdo_roundget_keycompression_permutationexpansion_permutations_boxs_box_1s_box_2s_box_3s_box_4s_box_5s_box_6s_box_7s_box_8p_box final_permtakeDrop unsafeDoIO byteSwap64 Data.BitspopCountMutableArray32Array64Array32Array8array8array32array64mutableArray32mutableArray32FromAddrBEmutableArray32Freeze arrayRead8 arrayRead32 arrayRead64mutableArrayRead32mutableArrayWrite32mutableArrayWriteXor32createKeyScheduleData.ByteArray.Mapping mapAsWord64 mapAsWord128toW64LEtoW64BEData.ByteArray.EncodingconvertFromBase convertToBase Base64OpenBSDBase64URLUnpaddedBase64Base32Base16BaseData.ByteArray.ViewdropViewtakeViewviewViewData.ByteArray.MethodsconvertallanyconstEqeqzero replicate copyAndFreezecopyRetcopyappendconcatspandroptakesplitAtindexxorsnoccons singletonunconsunpackpacknullempty unsafeCreateallocAndFreezecreateallocData.ByteArray.MemViewMemViewData.ByteArray.ScrubbedBytes ScrubbedBytesData.ByteArray.BytesBytesData.ByteArray.Types withByteArraylengthByteArrayAccessallocRet ByteArrayc_poly1305_finalizec_poly1305_updatec_poly1305_init$fEqAuth getEntropyPtrdefaultPoolSizechunk Control.ArrowfirstGHC.Base<*>pure Applicativeghc-prim GHC.TypesWordWord8Word16Data.TraversableforMControl.ApplicativeoptionalgetConstConst unwrapMonad WrapMonad WrappedMonad unwrapArrow WrapArrow WrappedArrow getZipListZipListsecond Data.FoldableforM_ byteSwap32 byteSwap16 Data.Functorvoid<$>liftA3liftA2liftA<**><$<**>manysome<|> Alternativeccryptonite_chacha_randomccryptonite_chacha_generateccryptonite_chacha_combineccryptonite_chacha_initccryptonite_chacha_init_core c_rc4_init c_rc4_combineccryptonite_salsa_generateccryptonite_salsa_combineccryptonite_salsa_initrunPseudoRandom$fMonadRandomMonadPseudoRandom$fMonadMonadPseudoRandom$fApplicativeMonadPseudoRandom$fFunctorMonadPseudoRandom$fMonadRandomIO Data.Eithereither$fMonadCryptoFailable$fApplicativeCryptoFailable$fFunctorCryptoFailable$fEqCryptoFailable$fShowCryptoFailable$fExceptionCryptoErrorNothingsquareTrue $fShowDigestc_md2_finalize c_md2_update c_md2_init$fHashAlgorithmMD2c_md4_finalize c_md4_update c_md4_init$fHashAlgorithmMD4c_md5_finalize c_md5_update c_md5_init$fHashAlgorithmMD5c_sha1_finalize c_sha1_update c_sha1_init$fHashAlgorithmSHA1c_sha224_finalizec_sha224_update c_sha224_init$fHashAlgorithmSHA224c_sha256_finalizec_sha256_update c_sha256_init$fHashAlgorithmSHA256c_sha384_finalizec_sha384_update c_sha384_init$fHashAlgorithmSHA384c_sha512_finalizec_sha512_update c_sha512_init$fHashAlgorithmSHA512c_sha512t_finalizec_sha512t_updatec_sha512t_init$fHashAlgorithmSHA512t_256$fHashAlgorithmSHA512t_224c_sha3_finalize c_sha3_update c_sha3_init$fHashAlgorithmSHA3_512$fHashAlgorithmSHA3_384$fHashAlgorithmSHA3_256$fHashAlgorithmSHA3_224c_kekkak_finalizec_kekkak_update c_kekkak_init$fHashAlgorithmKekkak_512$fHashAlgorithmKekkak_384$fHashAlgorithmKekkak_256$fHashAlgorithmKekkak_224c_ripemd160_finalizec_ripemd160_updatec_ripemd160_init$fHashAlgorithmRIPEMD160c_tiger_finalizec_tiger_update c_tiger_init$fHashAlgorithmTigerc_skein256_finalizec_skein256_updatec_skein256_init$fHashAlgorithmSkein256_256$fHashAlgorithmSkein256_224c_skein512_finalizec_skein512_updatec_skein512_init$fHashAlgorithmSkein512_512$fHashAlgorithmSkein512_384$fHashAlgorithmSkein512_256$fHashAlgorithmSkein512_224c_whirlpool_finalizec_whirlpool_updatec_whirlpool_init$fHashAlgorithmWhirlpoolxorMemdiffuse$fEqHMACccryptonite_scrypt_smixccryptonite_curve25519$fNFDataKeyPair$fNFDataPrivateKey$fNFDataPublicKey$fNFDataSignature$fNFDataParams$fNFDataCurveBinary $fNFDataPointdivmodtHashmultiplicationdpSlowdpFastdpFastNoBlinderinitializeWords$fDRGChaChaDRGsystemChunkSize$fDRGSystemDRG probabilistic firstPrimesdivides makeSignaturehashDigestASN1addDigestPrefix$fHashAlgorithmASN1RIPEMD160$fHashAlgorithmASN1SHA512t_256$fHashAlgorithmASN1SHA512t_224$fHashAlgorithmASN1SHA512$fHashAlgorithmASN1SHA384$fHashAlgorithmASN1SHA256$fHashAlgorithmASN1SHA224$fHashAlgorithmASN1SHA1$fHashAlgorithmASN1MD5$fHashAlgorithmASN1MD2normalizeToKeySizextsGFMul EphemeralKeygenerateEphemeral encryptWith initBlowfishBFdecryptContextcipher coreCryptomakeKeySchedule$fNFDataContextCamellia initCamelliakkwkeModeDecryptEncrypt w64tow128w64tow8w8tow64sboxsbox1sbox2sbox3sbox4sigma1sigma2sigma3sigma4sigma5sigma6rotl128 setKeyInterimfeistelflflinvgetKeyKgetKeyKegetKeyKw doBlockRounddoBlock encryptBlock decryptBlockpad16 $fEqAuthTagXTScbcEncryptGenericcbcDecryptGenericcfbEncryptGenericcfbDecryptGenericctrCombineGenericxtsEncryptGenericxtsDecryptGeneric xtsGeneric$fEqIV$fByteArrayAccessIVAESOCBAESGCMAESgcmModeocbModeinitAES encryptECB encryptCBCgenCTR genCounter encryptCTR encryptXTS decryptECB decryptCBC decryptCTR decryptXTSgcmInit gcmAppendAADgcmAppendEncryptgcmAppendDecrypt gcmFinishocbInit ocbAppendAADocbAppendEncryptocbAppendDecrypt ocbFinishc_aes_ocb_finishc_aes_ocb_decryptc_aes_ocb_encrypt c_aes_ocb_aadc_aes_ocb_initc_aes_gcm_finishc_aes_gcm_decryptc_aes_gcm_encrypt c_aes_gcm_aadc_aes_gcm_initc_aes_encrypt_ctrc_aes_gen_ctr_cont c_aes_gen_ctrc_aes_decrypt_xtsc_aes_encrypt_xtsc_aes_decrypt_cbcc_aes_encrypt_cbcc_aes_decrypt_ecbc_aes_encrypt_ecb c_aes_initsizeGCMsizeOCBkeyToPtrivToPtr ivCopyPtr withKeyAndIV withKey2AndIVwithGCMKeyAndCopySt withNewGCMStwithOCBKeyAndCopyStdoECBdoCBCdoXTS$fBlockCipher128AES$fBlockCipherAES $fCipherAES$fBlockCipherBlowfish448$fCipherBlowfish448$fBlockCipherBlowfish256$fCipherBlowfish256$fBlockCipherBlowfish128$fCipherBlowfish128$fBlockCipherBlowfish64$fCipherBlowfish64$fBlockCipherBlowfish$fCipherBlowfish$fBlockCipherCamellia128$fCipherCamellia128initDES$fBlockCipherDES $fCipherDESinit3DESinit2DES$fBlockCipherDES_EDE2$fBlockCipherDES_EEE2$fBlockCipherDES_EDE3$fBlockCipherDES_EEE3$fCipherDES_EEE2$fCipherDES_EDE2$fCipherDES_EDE3$fCipherDES_EEE3P256XP256Y P256Scalar P256Digitccryptonite_p256_from_binccryptonite_p256_to_binccryptonite_p256_is_valid_point#ccryptonite_p256_points_mul_vartimeccryptonite_p256e_point_addccryptonite_p256_basepoint_mulccryptonite_p256_modinv_vartimeccryptonite_p256_modmulccryptonite_p256_modccryptonite_p256_cmpccryptonite_p256_subccryptonite_p256_add_dccryptonite_p256_addccryptonite_p256_clearccryptonite_p256_is_zeroccryptonite_p256_initccryptonite_SECP256r1_bccryptonite_SECP256r1_pccryptonite_SECP256r1_n scalarSize pointSizescalarNeedReducing withNewPoint withPointpxToPywithNewScalarFreezewithTempScalar withScalarwithScalarZero allocTempallocTempScrubbedccryptonite_ed25519_signccryptonite_ed25519_sign_openccryptonite_ed25519_publickey publicKeySize secretKeySize signatureSize$fBlockCipher128AES256$fBlockCipherAES256$fBlockCipher128AES192$fBlockCipherAES192$fBlockCipher128AES128$fBlockCipherAES128$fCipherAES256$fCipherAES192$fCipherAES128