https://github.com/bonifatius94/primegen
a straight-forward prime generator (Miller-Rabin) and a naive implementation of the RSA algorithm
https://github.com/bonifatius94/primegen
csharp dotnet miller-rabin-test rsa-algorithm
Last synced: 8 days ago
JSON representation
a straight-forward prime generator (Miller-Rabin) and a naive implementation of the RSA algorithm
- Host: GitHub
- URL: https://github.com/bonifatius94/primegen
- Owner: Bonifatius94
- License: mit
- Created: 2021-06-12T22:51:48.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2021-09-11T18:48:58.000Z (almost 4 years ago)
- Last Synced: 2025-02-25T06:18:42.144Z (4 months ago)
- Topics: csharp, dotnet, miller-rabin-test, rsa-algorithm
- Language: C#
- Homepage:
- Size: 86.9 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# PrimeGen
## About
This project was created just for fun to try out some maths theory about
primality checks (Miller-Rabin) and the RSA algorithm.## Disclaimer
Do not use this project for any critical RSA encryptions. This is just a
straight-forward approach not dealing with common security risks, etc.## Usage
If you haven't done already, install dotnet to your dev machine.
Following commands show how to install dotnet onto Ubuntu 20.04.```sh
wget https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.debsudo apt-get update; \
sudo apt-get install -y apt-transport-https && \
sudo apt-get update && \
sudo apt-get install -y dotnet-sdk-5.0# official tutorial: https://docs.microsoft.com/de-de/dotnet/core/install/linux-ubuntu#2004-
```Download the source code by cloning this git repository.
```sh
git clone https://github.com/Bonifatius94/PrimeGen
cd PrimeGen
```Now you can run the project to create some primes that are used to
encrypt and decrypt a very simple message using the RSA algorithm.```sh
# use a non-optimized binary, working on any system
dotnet run# use an optimized binary (here: optimized for linux x64 systems)
dotnet run --runtime linux-x64 --configuration Release
```When running you may be prompted an output like the following example:
```text
Generating keys for RSA encryption (keylen=128 bits):
====================================================
p=22641425880588529119780961947471613697
q=64691136216422834958231258782814769181
N=1464699565775193873901347581743378875189028505571442438354476348766653072157
phi(N)=1464699565775193873901347581743378875101695943474431074276464128036366689280
e=84873714534479592302170843865699775323
d=716060456532699376833342290190195238176394542272471939021456502928274835667
====================================================
original message: 'Hello World, RSA encryption!'
encrypted message: ';/