将单文件ZUC256拆分为多文件,并封装init update final 方法

This commit is contained in:
zcy
2025-09-03 16:54:32 +08:00
parent 1b4c192180
commit 8880f2065e
7 changed files with 541 additions and 164 deletions

View File

@@ -1,16 +1,10 @@
package com.zuc.zuc256;
/**
* ZUC 内部状态LFSR(16x31bit) + R1/R2。
* Java 中用 int 保存(仅低 31 位有效)。
* ZUC状态类
*/
public final class Zuc256State {
public final int[] lfsr = new int[16]; // 线性反馈移位寄存器31bit/项
public int r1; // 32bit working register
public int r2; // 32bit working register
public void reset() {
for (int i = 0; i < lfsr.length; i++) lfsr[i] = 0;
r1 = 0; r2 = 0;
}
int[] LFSR = new int[16]; // 线性反馈移位寄存器
int R1; // 寄存器1
int R2; // 寄存器2
}