What is the Advanced Encryption Standard and how does it work?

Smart Tech Kitchen Group
4 min readOct 9, 2018

--

Let’s talk today about such an important concept of cryptocurrency sphere like cryptography.

Cryptography is a field of mathematical or linguistic (mostly used in ancient times) methods for securing information/message without hiding the fact of message existing. Basically, asymmetric cryptography (public key cryptography) is the most widespread type of blockchain technology, where users have private and public keys.

Today’s theme is AES — the Advanced Encryption Standard, in the field of cryptocurrency it is used for mining Monero.

What is AES?

AES is a symmetric block cipher. It consists of two paired algorithms one for encryption and the other for decryption. The process of decryption (transformation ciphertext back into the original text, which is called plaintext) uses the same key as the process of encryption. The key is known to both participants involved in the exchange of encrypted data.

Joan Daemen and Vincent Rijmen, the designers of the Advanced Encryption Standard

This standard transforms 128-bits blocks of information (sequences that consist of 128 symbols 1 and 0). The sender of the message is responsible for creating these sequences.

Block encryption means that the original text is divided into blocks, which are encrypted as separate parts.If the length of the message or its part is less than 128 bits, the block is supplemented with insignificant zeros up to the required size. At the same time, the encryption key length is not required to be equal 128 bits, in AES it could be three different lengths: 128, 192 and 256 bits.

Where is AES used?

The algorithm for Monero mining based on the using the AES New Instructions (AES-NI) for x86 architecture microprocessors. Single miners that do not use ASICs are not exposed to to high competition in that case, so this is an advantage of mining this cryptocurrency.

How it works?

Thanks to Intel’s development, instructions for implementing the AES algorithm are built-in the processors. It greatly simplifies the work with the algorithm and speeds it up.

In total, there are six instructions, which allow to encrypt data. Instructions are the set of commands that are applied to the input plaintext.

One of these instruction assists in round key generation. It produces 10, 12 or 14 128-bit round keys from the given key depending on its length (128, 192 or 256 bits). In that way, the procedures of encryption and decryption are performed in 10, 12 or 14 rounds. The corresponding instruction is executed in each round, and the user has an encrypted message after its performing.

It’s worth noting that the received round keys can be used only for data encryption. Another instruction (inversion) is applied to the existing encryption keys for creating a set of round keys intended for decryption. So, the user has two sets of round keys in the amount of 10, 12 or 14 pieces. Then, encryption or decryption algorithms can be applied to the data. AES-NI contains the instructions that are used for this purpose — the two instructions for implementing an encryption, and two ones for decryption.

Еncryption: procedure and instructions.

At first, the source plaintext is added to the source key (or its part if the key is larger than 128 bits). Bitwise addition implies the following: two sequences of zeros and ones are written one under the other, the character of the first line is added to the second one by the rule of “exclusive or” (XOR operation), where 1 + 1 = 0, 0 + 0 = 0, 0 + 1 = 1 + 0 = 1.

After adding the text and the key, we proceed to the transformation of the resulting sequence — for this we use the processor instruction, applying it to the obtained intermediate result and the key of the corresponding round. The above instruction implements one round of encryption, so we repeat its execution until the last but one round inclusive. The last round of encryption is different from the previous ones: the instruction is executed once on the intermediate result and key of the last round. That’s all — it is necessary to repeat the execution of the relevant instructions only a certain number of times, and we already have the cipher text.

Decryption is performed in the similar way with a set of round keys and two another processor instructions. The main requirement that allows a successful exchange of messages — the privacy of the given key.

What is the result?

  • instructions, that greatly simplify data encryption
  • simplicity, reliability and high performance of AES
  • the possibility of mining Monero cryptocurrency using PC

--

--