关于AES的S盒子的计算
对于置换piS 有如下计算:
The matrix used in AES is a rotational matrix based on the value 0x1F
, which is 00011111
in binary. The multiplication is performed in the field GF(2), as is the addition of the final vector 0x63
. Addition in GF(2) is the same as xor.
The bit indexes for the matrix are 76543210
, with 0
being the least significant bit and 7
being the most significant. Each column is the previous column rotated to the left by a single bit, as shown here:
0 7 6 5 4 3 2 1
1 0 7 6 5 4 3 2
2 1 0 7 6 5 4 3
3 2 1 0 7 6 5 4
4 3 2 1 0 7 6 5
5 4 3 2 1 0 7 6
6 5 4 3 2 1 0 7
7 6 5 4 3 2 1 0
For the AES 0x1F affine matrix, the bits are arranged in the following way:
1 0 0 0 1 1 1 1
1 1 0 0 0 1 1 1
1 1 1 0 0 0 1 1
1 1 1 1 0 0 0 1
1 1 1 1 1 0 0 0
0 1 1 1 1 1 0 0
0 0 1 1 1 1 1 0
0 0 0 1 1 1 1 1
For an input of 0x53
in AES, we first find its inverse, which is 0xCA
, represented in binary as 11001010
The affine transformation is as follows. The input bits are multiplied against the bits of a given row, with the first bit the LSB of the input. Input bit 0 is only multiplied by row bit 0, and so on. Only when both values are one (logical AND) is the result one. Finally, all bits are XORd against eachother within that row to generate the transformed bit for that row.
Input = 0 1 0 1 0 0 1 1 (LSB First)
Row 0 = 1 0 0 0 1 1 1 1
Bit 0 = 0 0 0 0 0 0 1 1 = 0
Row 1 = 1 1 0 0 0 1 1 1
Bit 1 = 0 1 0 0 0 0 1 1 = 1
Row 2 = 1 1 1 0 0 0 1 1
Bit 2 = 0 1 0 0 0 0 1 1 = 1
Row 3 = 1 1 1 1 0 0 0 1
Bit 3 = 0 1 0 1 0 0 0 1 = 1
Row 4 = 1 1 1 1 1 0 0 0
Bit 4 = 0 1 0 1 0 0 0 0 = 0
Row 5 = 0 1 1 1 1 1 0 0
Bit 5 = 0 1 0 1 0 0 0 0 = 0
Row 6 = 0 0 1 1 1 1 1 0
Bit 6 = 0 0 0 1 0 0 1 0 = 0
Row 7 = 0 0 0 1 1 1 1 1
Bit 7 = 0 0 0 1 0 0 1 1 = 1
The final result LSB first is 01110001
or MSB first is 10001110 = 0x8E
. This value is then added (XOR) to the final vector 0x63
, giving an output of 0xED
From:https://crypto.stackexchange.com/questions/10996/how-are-the-aes-s-boxes-calculated
关于AES的S盒子的计算的更多相关文章
- box-sizing重置盒子模型计算规则
目标大纲 一.语法声明 box-sizing : content-box | border-box | inherit 二.属性值说明 content-box 在宽度和高度之外绘制元素的内边距和边框 ...
- css 大话盒子模型
什么是盒子模型? CSS中, Box Model叫盒子模型(或框模型),Box Model规定了元素框处理元素内容(element content).内边距(padding).边框(border) 和 ...
- 深入理解CSS盒子模型
在CSS中浮动.定位和盒子模型,都是很核心的东西,其中盒子模型是CSS很重要基石之一,感觉还是很有必要把CSS盒子模型相关知识更新一下...... CSS盒子模型<BoxModel>示意图 ...
- CSS3:box-sizing:不再为盒子模型而烦恼
题外话: W3C奉行的标准,就是content-box,就是须要计算边框,填充还有内容的;可是就我个人而言, 比較喜欢的是传统IE6时候的怪异模式,不用考虑容器是否会被撑开(打乱布局); 盒子模型差异 ...
- 第49天学习打卡(CSS 层次选择器 结构伪类选择器 属性选择器 美化网页元素 盒子模型)
推荐书籍:码出高效: Java 开发手册 2.2 层次选择器 idea里代码规范是按:ctrl +alt+L快捷键 注释快捷键:ctrl+/ 1.后代选择器:在某个元素的后面 祖爷爷 爷爷 爸爸 你 ...
- 分组密码(四)AES算法① — 密码学复习(七)
介绍完S-PN型结构之后,下面介绍AES算法.由于内容比较多所以将其分为两篇来介绍,本篇主要讲AES的历史时间节点.产生背景.与DES的对比.算法框图(粗略)以及一些数学基础. 7.1 AES的历史时 ...
- Homomorphic Evaluation of the AES Circuit:解读
之前看过一次,根本看不懂,现在隔这么久,再次阅读,希望有所收获! 论文版本:Homomorphic Evaluation of the AES Circuit(Updated Implementati ...
- CSS-垂直|水平居中问题的解决方法总结
题外话:前两天和专业老师探讨最近的一个项目,涉及到对一个浮动的盒子局中的问题,老师的解决方法打开了我的新思路.让我有了总结一下平时的居中问题的想法.不然可能忘掉了以后又要到处寻找解决办法了.另外也给我 ...
- CSS3的基础用法
CSS3的现状:1.浏览器支持程度差,需要添加私有前缀 2.移动端支持优于PC端 3.不断改进中 4.应用相对广泛 在CSS3中增加新增了许多灵活查找元素的方法,极大的提高了查找元素的效率和精准度.C ...
随机推荐
- python 04 分支和循环
创建一个框架 名字.py 打飞机游戏 加载音乐 播放音乐 我打飞机诞生 inter=0 while true: if 用户是否惦记了关闭: 退出程序 bleak inter+=1 if inter ...
- leetcode刷题记录——哈希表
1.两数之和 可以先对数组进行排序,然后使用双指针方法或者二分查找方法.这样做的时间复杂度为 O(NlogN),空间复杂度为 O(1). 用 HashMap 存储数组元素和索引的映射,在访问到 num ...
- 封装Vue Element的form表单组件
前两天封装了一个基于vue和Element的table表格组件,阅读的人还是很多的,看来大家都是很认同组件化.高复用这种开发模式的,毕竟开发效率高,代码优雅,逼格高嘛.虽然这两天我的心情很糟糕,就像& ...
- BIGI行情http请求实时行情数据方式
BIGI行情http请求实时行情数据方式 新浪财经文华财经并非实时行情数据源,所以获取的行情数据源也并非实时的.以下介绍的方法和新浪财经获取行情数据源的方法是一致的.需要实时行情数据源可以向BIGI行 ...
- Eclipse导入项目后JSP页面出现报红
Multiple annotations found at this line:- javax.servlet.jsp.JspException cannot be resolved to a typ ...
- 【小白学AI】XGBoost推导详解与牛顿法
文章来自微信公众号:[机器学习炼丹术] 目录 1 作者前言 2 树模型概述 3 XGB vs GBDT 3.1 区别1:自带正则项 3.2 区别2:有二阶导数信息 3.3 区别3:列抽样 4 XGB为 ...
- 牛客网数据库SQL实战解析(41-50题)
牛客网SQL刷题地址: https://www.nowcoder.com/ta/sql?page=0 牛客网数据库SQL实战解析(01-10题): https://blog.csdn.net/u010 ...
- shell脚本同步私人git仓库
前言 分别在个人电脑.个人服务器.码云三个地方建立了数据仓库用于保存自己的各种数据,通过git+shell进行数据同步. 此举不仅可以避免因存储损坏.版本更迭.数据误操作等因素带来的各种麻烦,也能实现 ...
- VSCode 快速生成.vue基本模板、发送http请求模板
安装vscode 官网:https://code.visualstudio.com/ 安装 Vetur 插件,识别 vue 文件 插件库中搜索Vetur,点击安装,安装完成之后点击重新加载 新建代码片 ...
- 光年数据分析表(seo数据监控表和爬虫数据监控表)
http://www.wocaoseo.com/thread-307-1-1.html 光年seo培训想必很多人都知道,他们提出的数据化操作影响了很多的seo从业者,下面是他们的2个数据表,搜集于网络 ...