将单文件ZUC256拆分为多文件,并封装init update final 方法
This commit is contained in:
@@ -1,29 +1,15 @@
|
||||
package com.zuc.zuc256;
|
||||
|
||||
/**
|
||||
* MAC 上下文(可选:ZUC-256-EIA3 类似流程)
|
||||
* 这里只给出骨架,按你的 C 代码把细节补齐。
|
||||
* MAC上下文类
|
||||
*/
|
||||
public final class Zuc256MacCtx {
|
||||
private final Zuc256State st = new Zuc256State();
|
||||
private int macBits; // 32/64/128...
|
||||
private int acc; // 累加器/寄存器,视实现调整
|
||||
|
||||
public void init(byte[] key32, byte[] iv, int macBits) {
|
||||
this.macBits = macBits;
|
||||
this.acc = 0;
|
||||
Zuc256Core.init(st, key32, iv);
|
||||
// TODO: 若 MAC 需特殊 IV/派生,按 C 版本处理
|
||||
throw new UnsupportedOperationException("TODO: MAC init details");
|
||||
}
|
||||
|
||||
public void update(byte[] data, int off, int len) {
|
||||
// TODO: 消耗比特/字节流并累积 acc
|
||||
throw new UnsupportedOperationException("TODO: MAC update");
|
||||
}
|
||||
|
||||
public void finish(byte[] tag, int tagOff) {
|
||||
// TODO: 输出 macBits 位标签到 tag[]
|
||||
throw new UnsupportedOperationException("TODO: MAC finish");
|
||||
}
|
||||
int[] LFSR = new int[16];
|
||||
int R1;
|
||||
int R2;
|
||||
byte[] buf = new byte[4];
|
||||
int buflen;
|
||||
int[] T = new int[4];
|
||||
int[] K0 = new int[4];
|
||||
int macbits;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user