HAN-ASD-DT/rsa/1.0.3

NOTE: the latest version is 1.1.0

Unavailable. Nobody can download this version any more, with elm or with the Lamdera compiler: github.com/HAN-ASD-DT/rsa is gone (deleted or private); Software Heritage has not archived the repo; no fork with tag 1.0.3 found (60 same-name repos checked); no cached copy. Use another version.

Details

RSA

The RSA crypto-system in Elm.

Constructors

generate : Int -> Int -> Result GenerationError ( PublicKey, PrivateKey )

Generates a key-pair for the RSA crypto-system.

The arguments should be two primes. Note that the primes should remain private.

The private keys of the RSA crypto-system.

Uses to decrypt a message.

type alias PublicKey =
{ n : Int
, e : Int
}

The public keys of the RSA crypto-system.

Used to encrypt a message.

Usage

encrypt : PublicKey -> Int -> Int

Encrypts a message.

decrypt : PrivateKey -> Int -> Int

Decrypts a message.

Error Handling

The reason why a key-pair generation can go wrong.

Returns a String detailing why the key-pair generation failed.

Usage

let
    ( public, private ) =
        generate 37 79
in
encrypt public value