框架初始化
This commit is contained in:
35
src/com/zuc/zuc256/Zuc256Core.java
Normal file
35
src/com/zuc/zuc256/Zuc256Core.java
Normal file
@@ -0,0 +1,35 @@
|
||||
package com.zuc.zuc256;
|
||||
|
||||
/**
|
||||
* ZUC-256 核心:状态初始化、密钥字生成、密钥流生成。
|
||||
* 仅保留对外 API 与内部步骤骨架,细节待填。
|
||||
*/
|
||||
public final class Zuc256Core {
|
||||
|
||||
private Zuc256Core() {}
|
||||
|
||||
/** 初始化状态(Key + IV) */
|
||||
public static void init(Zuc256State st, byte[] key32, byte[] ivN) {
|
||||
// TODO: 1) 按表和 key/iv 装载 LFSR 初值
|
||||
// TODO: 2) 置 R1/R2
|
||||
// TODO: 3) 预运行若干轮
|
||||
throw new UnsupportedOperationException("TODO: init");
|
||||
}
|
||||
|
||||
/** 生成单个 32bit 密钥字 */
|
||||
public static int generateKeyword(Zuc256State st) {
|
||||
// TODO: 1) BitReconstruction
|
||||
// TODO: 2) 非线性变换 F -> W
|
||||
// TODO: 3) LFSR 下一步(with/without carry 按标准)
|
||||
// TODO: 4) 输出 W ⊕ X(??)(依实现)
|
||||
throw new UnsupportedOperationException("TODO: generateKeyword");
|
||||
}
|
||||
|
||||
/** 生成 nwords 个 32bit 密钥字到 ks[] */
|
||||
public static void generateKeystream(Zuc256State st, int nwords, int[] ks) {
|
||||
for (int i = 0; i < nwords; i++) {
|
||||
ks[i] = generateKeyword(st); // TODO: 替换为高效批量实现(可选)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user