Speck
Speck是一类轻量级的分组密码,最早由美国国家安全局(NSA)于2013年6月提出[2]。如今Speck码较多应用于软件实现,而其姊妹算法Simon则多用于硬件实现。
![]() 3 rounds of Speck with 2-word key schedule | |
| 概述 | |
|---|---|
| 设计者 | Ray Beaulieu, Douglas Shors, Jason Smith, Stefan Treatman-Clark, Bryan Weeks, Louis Wingers NSA |
| 首次发布 | 2013 |
| 相关算法 | Simon、Threefish |
| 密码细节 | |
| 密钥长度 | 64, 72, 96, 128, 144, 192 or 256 bits |
| 分组长度 | 32, 48, 64, 96 or 128 bits |
| 结构 | ARX |
| 重复回数 | 22–34 (depending on block and key size) |
| 速度 | 2.6 cpb (5.7 without SSE) on Intel Xeon 5640 (Speck128/128) |
| 最佳公开破解 | |
| 差分密码分析[1] | |
编码描述
Speck支持多种分组密文长度。单个分组总是包含两个单字,每个单字可以由16位、24位、32位、48位或64位比特组成。相关密文由2、3或4个词汇组成。编码的循环函数包含两次反转计算:将右单字添加到左单字,异或密文与左单字;之后异或左单字与右单字。循环的次数取决于参数的选择如下[2]:
| 块大小(bits) | 秘钥大小(bits) | 循环次数 |
|---|---|---|
| 2×16=32 | 4×16=64 | 22 |
| 2×24=48 | 3×24=72 | 22 |
| 4×24=96 | 23 | |
| 2×32=64 | 3×32=96 | 26 |
| 4×32=128 | 27 | |
| 2×48=96 | 2×48=96 | 28 |
| 3×48=144 | 29 | |
| 2×64=128 | 2×64=128 | 32 |
| 3×64=192 | 33 | |
| 4×64=256 | 34 |
密码次序表与主块密码使用相同的循环函数。
参考代码
以下是编码算法实现的设计参考,使用C语言编写,其具有128比特的分组大小与密文。
#include <stdint.h>
#define ROR(x, r) ((x >> r) | (x << (64 - r)))
#define ROL(x, r) ((x << r) | (x >> (64 - r)))
#define R(x, y, k) (x = ROR(x, 8), x += y, x ^= k, y = ROL(y, 3), y ^= x)
#define ROUNDS 32
void encrypt(uint64_t ct[2],
uint64_t const pt[2],
uint64_t const K[2])
{
uint64_t y = pt[0], x = pt[1], b = K[0], a = K[1];
R(x, y, b);
for (int i = 0; i < ROUNDS - 1; i++) {
R(a, b, i);
R(x, y, b);
}
ct[0] = y;
ct[1] = x;
}
参考文献
This article is issued from Wikipedia. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.
