CryptoCalculator - 2020


*The original version with just the powerMod calculator was attained from: https://www.mtholyoke.edu/courses/quenell/s2003/ma139/js/powermod.html

CryptoCalculator

by: @Sqeel404


This is a piece of work created to help with identifying and understanding the beginner levels of IT Security and encryption techniques

The largest value that this Calculator can calculate is 9007199254740991 due to standard Javascript restrictions

For the Large Number Calculator (with no limits apart from the speed that your computer takes to process)
you can visit the other page Big Integer Calculator

*The Big Number Calculator also has more calculators and examples to work with...

Contents:



Modular Calculators:


Mod Calculation



PowerMod Calculation


Modular Inverse:




General Tools:


Generate Random Prime number



Generate Random Number




Elgamal Examples:


Sender has: y, g, p values

Receiver has all values and has secret x value

Tools:



Encode:


Step 1 - Calculate y (y):



Step 2 - Calculate k (k):




Step 3 - Calculate Code 1 (C1):




Step 4 - Calculate Code 2 (C2):





Step 4 (Exponential) - Calculate Code 2 (C2):




Decode:



Step 1 - Calculate (encoded) k (k):



Step 2 - Modular Inverse:




Step 3 - Decrypt Message:




Step 3 - Exponential Decrypt Message:

Get Value A:

*Use C2 value from Step 4 (Exponential) - Calculate Code 2 (C2)



Get Message:




Paillier Examples:


symbols: - Φ - λ - μ

Sender has: n,g Values

Receiver has all values including secret λ and μ values

Tools:

*If you want to manually enter the values, enter them in the inputs instead of clicking on compute button

[ p ]
Generate a random prime number for (p) :
Enter maximum value of number then click compute:
[ q ]
Generate a random prime number based on (p) :
Enter maximum value of number then click compute:
[ n ]
Calculate based on (p) and (q) :
[ g ]
Generate (g) based on (n) :
[ r ]
Generate random number (r) :
Enter maximum value of number then click compute:
[ m ] Create message to encode (m):


Encode:


Get λ (Lambda) value:


Enter Value P (p) : Value Q (q) :
[ λ ] = lcm(p - 1, q - 1) =


Calculate K Value :


Enter Value G (g) : Value λ (Lambda) (λ) : Value N (n) :
[ k ] = L(gλ MOD n2) =

Calculate μ (Mu) Value :


Base k (k) : Public key n (n) :
[ μ ] = k-1 MOD n =

Encrypt Message (c) :


Base g (g) : Base r (r) : Exponent and Modulus n (n) : Message to encrypt m (m) :
[ c ] = gmrn MOD n2 =


Decode:

Decrypt Message (M) :


Encrypted message c (c) : Exponent λ (λ) : Modulus n (n) : Value μ(μ) :
[ m ] = L(cλMOD n2).μ MOD n =


Project Details:


CryptoCalculator


Created by: @sqeel404


Description

This project was put together during the mid semester break to help identify and understand the underlying concepts, formulas and principles within the Cryptography classes.

There are 3 main pages:

index.html - https://cryptocalc.com.au/original-content/originalcalc.html

This is the original site, it holds the standard base calculations in javascript, however due to the javascript large number limitations it can not hadle substantially large numbers, so it ony contains the basic concepts and tools, such as:

BigIntCalculator.html - https://cryptocalc.com.au/original-content/bigintcalculator/bigintcalculator.html

This is a child of the original site, it has the same initial calculations, however this version uses the BigInteger.js javascript library which allows uses to do calculations on substantially large numbers. Due to this, further examples have been added as they can use substantially larger numbers for their calculations.

The tools so far are:

*The Paillier version for secret addition of numbers will be added shortly for reference.


Main Site - https://cryptocalc.com.au

This is the new main site and holds all the original calculators, plus extra General tools, hashing examples, IPFS examples and more.

The main site is now the updated version to follow and use as it has substantially higher calculations, resources and tools.


Enjoy, and hope it helps fellow users in their cryptographic learnings and education.