aes256位加密
AES (Advanced Encryption Standard) is the most widely used symmetric encryption algorithm. AES is used in a wide array of applications that include the encryption of data at rest, and secure file transfer protocols like HTTPS.
AES(高级加密标准)是使用最广泛的对称加密算法。 AES用于各种各样的应用程序中,包括静态数据的加密以及安全文件传输协议(例如HTTPS)。
AES is the successor to DES. The Data Encryption Standard (DES) is a symmetric encryption algorithm that was developed at IBM. Back in the day, DES used to be the de facto encryption algorithm. However, it used a 56-bit key, and as technology progressed attacks against it started to become more plausible. Eventually, DES was deemed too insecure for continued use. The community transitioned to triple DES (which is still around today). In essence, triple DES is DES performed 3 times consecutively. As one might expect, triple DES is 3 times more secure than just plain DES. However, it’s also 3 times slower.
AES是DES的后继产品。 的 数据加密标准(DES)是IBM开发的对称加密算法。 过去,DES曾经是事实上的加密算法。 但是,它使用了56位密钥,并且随着技术的进步,针对它的攻击开始变得更加合理。 最终,DES被认为过于安全,无法继续使用。 社区过渡到三重DES (至今仍然存在)。 本质上,三重DES是连续执行3次的DES。 如人们所料,三重DES的安全性是普通DES的3倍。 但是,它也慢了3倍。
The US government held a competition to come up with an alternative to triple DES. In the end, Rijndael, written by the two Belgian cryptologists Vincent Rijmen and Joan Daemen, was chosen for its performance and its ease of implementation on both hardware and software, as well as its level of security. Rijndael became the Advanced Encryption Standard for the US, and ultimately for the rest of the world as well.
美国政府举行了一场竞赛,提出了替代三重DES的替代方案。 最后,由两位比利时密码学家Vincent Rijmen和Joan Daemen撰写的Rijndael,由于其性能以及在硬件和软件上的易于实现性以及安全级别而被选中。 Rijndael成为美国乃至世界其他地区的高级加密标准 。
AES加密算法 (AES Encryption Algorithm)
Suppose Bob wanted to send a message to Alice. Bob’s unencrypted message is first broken down into 128-bit chunks. The bytes (16 in all) in a given chunk are then organized as a 4x4 matrix.
假设鲍勃想向爱丽丝发送一条消息。 Bob的未加密消息首先被分解为128位块。 然后将给定块中的字节(总共16个)组织为4x4矩阵。

The block is passed through the following sequence of steps a total of x times, where x depends on the size of the cypher key.
该块总共经过x次以下步骤序列,其中x取决于密码密钥的大小。
- Substitute Bytes 替代字节
- Shift Rows 排行
- Mix Columns 混合列
- Add Round Key 添加回合密钥
替代字节 (Substitute Bytes)
In this step, each element in the matrix is mapped to the corresponding byte in the Rijndael S-box.
在此步骤中,矩阵中的每个元素都映射到Rijndael S-box中的相应字节。

For example, the element in the top left corner is mapped to d4
since the first hexadecimal is 1
and the other hexadecimal is 9
.
例如,左上角的元素映射到d4
因为第一个十六进制为1
,另一个十六进制为9
。


Repeating the process for every element, we obtain the following matrix:
对每个元素重复该过程,我们获得以下矩阵:

排行 (Shift Rows)
In the second step, we rotate each element x elements (bytes) to the left, where x is the index of the row.
在第二步中,我们将每个元素向左旋转x个元素(字节),其中x是该行的索引。
- Row 0 — Shift left 0 bytes (i.e. don’t shift) 第0行-向左移位0个字节(即不移位)