Skip to content

aionescu/rabin-cryptosystem

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rabin-cryptosystem

Haskell implementation of Rabin's Public Key Cryptosystem, written for the Public Key Cryptography course @ Babes-Bolyai University, Cluj-Napoca

Prerequisites

  • GHC >= 9.6
  • cabal >= 3.10

(Both can be installed via ghcup)

Installing & Running

To install the project, simply run cabal install. Afterwards, you can simply run it as rabin.

If you don't want to install it, you can run it locally using the provided run.sh script.

CLI Interface

rabin gen-priv-key [--bits N] # Writes the binary-encoded private key to stdout. Defaults to 256 bits
rabin gen-pub-key # Reads the private key from stdin, writes the public key to stdout
rabin encrypt --pub-key PATH # Reads the plaintext message from stdin, writes the ciphertext to stdout
rabin decrypt --priv-key PATH # Reads the ciphertext from stdin, writes the cypheretext to stdout

If you haven't installed the project, use ./run.sh instead of rabin.

Example usage

# Generate private/public key pair
rabin gen-priv-key >a.key
rabin gen-pub-key <a.key >a.pub

# Encrypt a file, e.g. an image
rabin encrypt --pub-key a.pub <image.png >image.enc
rabin decrypt --priv-key a.key <image.enc >decrypted.png

Security Notice

Aside from the Rabin cryptosystem's known weaknesses, the implementation may also be vulnerable to timing attacks or other exploits.

Do not use this for security-critical systems.

License

This repository is licensed under the terms of the GNU General Public License v3. For more details, see the license file.

About

Rabin Cryptosystem implementation in Haskell

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published