Data exchange and data protection is the foundation of civil society. And asymmetric cryptography is undoubtedly becoming part of basic literacy, along with reading, writing, and basic mathematics.

Modern cryptographic systems are based on arithmetic calculations. Any data object (text, image, document, file, program, etc.) on a computer or website on the Internet is represented in the form of numbers. You can perform algebraic calculations with these numbers. The encryption process involves arithmetic operations on integers. And the result of encryption is also numbers.

Encryption types

There are two principles of encryption: symmetric and asymmetric.

Symmetric cipher

-- The same key is used for encryption and decryption.

A + B = C ⎯ encode
C - B = A ⎯ decode

A ⎯ message
B ⎯ encryption key
C ⎯ encrypted message

If the encrypted object is longer than the encryption key, the object is split into blocks and encrypted block by block.

Naive block cipher
File blocks123234345...567...789
Encryption key210210210210210
Encrypted blocks333444555777999

Asymmetric cipher

-- Two (different) keys are used for encryption and decryption.

Modular arithmetic ⎯ is a computational method used in cryptography. It's worth recalling the concept of division with remainder from the school curriculum.

Calculation formulas
--------------------
B × B-1 = 1 (mod M) ⎯ encryption keys
A × B   = C (mod M) ⎯ encode
C ÷ B   = ? (mod M) ⎯ decoding is impossible, ÷ undefined
C × B-1 = A (mod M) ⎯ decode

Example of an encryption key pair
---------------------------------
M   = 17 ⎯ module
B   =  5 ⎯ encryption key
B-1 =  7 ⎯ decryption key
5 × 7 = 35 = 1 (mod 17) ⎯ mutually reciprocal numbers

An example of encryption and decryption
---------------------------------------
A = 8 ⎯ message
8 × 5 = 40 = 6 (mod 17) ⎯ message encryption
6 × 7 = 42 = 8 (mod 17) ⎯ message decryption

Asymmetric cryptography involves the use of two keys ⎯ a Private (secret) key and a Public (open, shared) key. In practice, it is impossible to calculate a private key from a public key.

The first application of asymmetric cryptography is the encryption of a message with a public key for the owner of a private key. No one other than the owner of the private key will be able to decrypt this message.

Digital signature

Some asymmetric cryptographic schemes allow the use of a secret key for encryption. The encrypted message will be decrypted using the public key. Since the encryption key is not suitable for decryption, the cipher that is decrypted by the public key can be considered the equivalent of a signature.

Message × Private_Key = Encrypted_Message ⎯ Calculating a digital signature
Encrypted_Message × Public_Key = Message  ⎯ Digital signature verification

Encrypted_Message ⎯ Digital Signature equivalent

The public key can be used for encryption, but the result will be different and cannot be decrypted by the public key.


Please note!
⎯ Presented computational schemes are extremely simplified.
⎯ At the initial stage, calculation schemes are considered without the required properties of the numbers used.

The main goal of Subskribita.net is to minimize the barrier to entry into cryptography. Practical encryption will require a little more effort ;-)

No niin, let's get started!

The Foundation

Hash ⎯ Message Digest algorithm, an one-way function transforms input data of arbitrary dimension into fixed-size value.

Conversion and encoding ⎯ number systems and data.

Block Cipher ⎯ is essential for data exchange.

Modular calculations ⎯ implementation of arithmetic operations for large integers.

Primality test and finding prime numbers. Prime numbers are basis for asymmetric cryptographic schemes.

Common Cryptographic Schemes

RSA ⎯ Rivest-Shamir-Adleman oldest and current algorithm for asymmetric encryption and document signing.

Simple Cryptography ⎯ Block Cipher + RSA, practical encryption and digital signature.

DH ⎯ Diffie–Hellman key exchange protocol. Mathematical method of securely generating a symmetric cryptographic key over a public channel.

ElGamal ⎯ encryption algorithm.

Schnorr ⎯ digital signature scheme.

DSA ⎯ Digital Signature Algorithm.

Elliptic Curve ⎯ mathematical model and computational apparatus that are suitable for implementing cryptographic schemes.

ECDSA ⎯ Elliptic Curve DSA. A widely used digital signature algorithm implemented in Bitcoin.

ECDH ⎯ Elliptic Curve DH.

DL ∥ EC ⎯ demonstration of the implementation of the Diffie–Hellman scheme


🍩