NTRU-1.0.0.0: NTRU Cryptography

StabilityExperimental
Maintainerjulrich@cyberpointllc.com
Safe HaskellNone

Math.NTRU

Description

License : New BSD

This is an implementation of the NTRU cryptographic system, following the standard set forth by the IEEE in the document entitled IEEE Standard Specification for Public Key Cryptographic Techniques Based on Hard Problems over Lattices (IEEE Std 1363.1-2008). It is designed to be compatible with the implementation of SecurityInnovations, available here.

Synopsis

Documentation

keyGenSource

Arguments

:: ParamSet

Parameter set, most likely the output of genParams

-> IO ([Integer], [Integer])

A tuple representing (PublicKey, PrivateKey) where PrivateKey = 1 + pf, per enhancement #2.

Generates a random PublicKey-PrivateKey Pair

encryptSource

Arguments

:: ParamSet

Parameter set, most likely the output of genParams

-> [Integer]

A list of ASCII values representing the message

-> [Integer]

A list of numbers representing the public key

-> IO [Integer]

A list of numbers representing the ciphertext

Encrypts a message using the given parameter set

decryptSource

Arguments

:: ParamSet

Parameter set, most likely the output of genParams

-> [Integer]

A list of numbers representing the private key

-> [Integer]

A list of numbers representing the public key

-> [Integer]

A list of numbers representing the ciphertext

-> Maybe [Integer]

A list of numbers representing the original message

  1. 3.3 Decrypts e using the private key f and verifies it using the public key h.

genParamsSource

Arguments

:: String

Desired parameter set: This should be either one of the 12 listed in the IEEE Standard (1363.1-2008) Annex A

-> ParamSet

Parameter set to be used by keyGen, encrypt, or decrypt

Generates the proper parameter set based on the given bit level

data ParamSet Source

The Parameter Set Record

Constructors

ParamSet 

Fields

getN :: Int

The size of the polynomials

getP :: Integer

The small modulus p

getQ :: Integer

The large modulus q

getDf :: Int

The number of 1's in f

getDg :: Int

The number of 1's in g

getLLen :: Int

The length of the encoded message length (should probably be 1)

getDb :: Int

The number of random bits prefixed to the message

getMaxMsgLenBytes :: Int

The max number of bytes in the message

getBufferLenBits :: Int

The size of the resulting message before conversion to trits

getBufferLenTrits :: Int

The size of the resulting message after conversion to trits

getDm0 :: Int

Minimum number of 1's, -1's and 0's in the message for decryption to succeed

getShaLvl :: Int

SHA algorithm to use. Should be either 1 or 256

getDr :: Int

The number of 1's in the blinding polynomial

getC :: Int

Used by index generator function

getMinCallsR :: Integer

Used by mask generator

getMinCallsMask :: Int

Used by mask generator

getOID :: [Int]

Parameter set ID

getPkLen :: Int

Used to create SData

getBitLvl :: Int

Bit level security

Instances