Encryption

Encryption is a process that turns information (plain text) into cyphertext through the use of a cypher. The cyphertext is unreadable to anyone except the people who know the cypher and usually some associated key. Unlike the hashing process, encrypted text can be decrypted. This makes it useful for storing and transmitting sensitive data.

Encryption Function

Since data that is encrypted must be able to be decrypted, an encryption function must be invertible (one-to-one and entire) over the set of all possible input data. This means each step in the process must also be invertible. One way to accomplish encryption is to use a matrix (with a non-zero determinant). Split the text into several matrices (padding input as necessary). Then apply the transformation matrix to each input matrix and concatenate the result. However, most modern encryption schemes use a combination of transformation matrices and bit twiddling to accomplish encryption.

Encryption in Cryptography

The usefulness of encryption for cryptography is quite obvious. In fact, most of cryptography is centered around encryption and decryption.

AES-128 Encryption and Decryption Function (slightly modified)

I made an AES-128 Encryption/Decryption implementation for my password program. Here’s one that uses the same exact algorithm, but in JavaScript (feel free to look at the source code):


Encryption:

Plaintext: Password:


Decryption:

Cyphertext: Password: