Content Disclaimer
Copyright @2020.
All Rights Reserved.

StatsToDo: Encryption

Links : Home Index (Subjects) Contact StatsToDo


Introduction RC4 AES RSA

Disclaimer

I created this page during the Covid pandemic lockdown of 2021, partly to have something to do, partly to teach myself encryption, and partly to teach myself Python. Although I have done all I can to make sure the results are correct and reproducible, the algorithms presented on this page has not been extensively reviewed or tested, so that errors and omissions cannot be ruled out.

Readers are reminded that there are numerous professionally developed encryption products. They are inexpensive and readily available, and should be used for any serious encryption needs. The contents of this page should therefore be treated as merely an exercise, and readers wishing to use them must accept their own responsibility for doing so.

Introduction

The history and usage of encryption is well describe and summarised in wikipedia, and not repeated here.

For personal security needs, Microsoft Office, pdf, and Winzip all include the AES algorithm, which is considered secure as of 2021. For professional and institutional security, particularly for transmission and protection against intrusion, the pgp algorithm, in its various commercial variants is widely available and inexpensive. Most email clients also offer similar products as plug in. The 2020 review of available products can be consulted.

Programs

This page presents 3 of the most commonly used encryption algorithms, each in its own set of sub-panels
  • The RC4 algorithm is a symmetrical key stream cipher. It uses the same password for encryption and decryption, and it process information in a continuous manner, so it is very fast and able to handle large quantity of data. It was developed in the 1980s, and initially used extensively for transmission of information electronically. Since the new century, flaws were found which limits the use of this algorithm (more information in the sub-panel)
  • The AES algorithm is a symmetrical key block cipher. It uses the same password for encryption and decryption, but procesess information in blocks. It is currently (2021) considered to be practically unbreakable, and used both by the US military and most commercial products. It is slower than RC4, but for most documents other than large files, the difference is not noticeable.
  • The RSA is a asymmetrical key cipher. The key for encryption is public, and different to the key for decryption which is private. It is therefore suitable for protecting information during transmission, as the public key can be send to everyone, but only the holder of the private key can decrypt. The size of the key determines the level of security, but also the time and memory resources requird for processing. Large documents are therefore usually encrypted with one of the symmetrical key ciphers, and RSA is then used to encrypt the password.
Each of the 3 encryption algorithms (RC4, AES, and RSA) are presented in its separate panel. In each, the sub-panels are
  • An brief introduction
  • A Javascript interactive program which allows the user to encrypt and decrypt immediately, without having to access other applications. The user can also access the Javascript program in the source code of the page
  • Python codes for those preferring to develop their own applications. Two flavours are presented
    • Program depending on the package Cryptography, with Crypto imported. The library is tested, validated, and trusted. The backgorund C processing enabled the program to run very fast and handle large values. As the library does all the work, the user interface is terse and easy to understand.
    • Program in plain Python, using only the basic Python packages. The calculations are transparent to the user so can be used to demonstrate how the calculations are done. However, it is slower, has limitations on the size of numbers, and for complicated algorithms such as the AES, difficult to understand.