use of com.github.zhenwei.core.crypto.params.KDFCounterParameters in project LinLong-Java by zhenwei1108.
the class KDFCounterBytesGenerator method init.
public void init(DerivationParameters param) {
if (!(param instanceof KDFCounterParameters)) {
throw new IllegalArgumentException("Wrong type of arguments given");
}
KDFCounterParameters kdfParams = (KDFCounterParameters) param;
// --- init mac based PRF ---
this.prf.init(new KeyParameter(kdfParams.getKI()));
// --- set arguments ---
this.fixedInputDataCtrPrefix = kdfParams.getFixedInputDataCounterPrefix();
this.fixedInputData_afterCtr = kdfParams.getFixedInputDataCounterSuffix();
int r = kdfParams.getR();
this.ios = new byte[r / 8];
BigInteger maxSize = TWO.pow(r).multiply(BigInteger.valueOf(h));
this.maxSizeExcl = maxSize.compareTo(INTEGER_MAX) == 1 ? Integer.MAX_VALUE : maxSize.intValue();
// --- set operational state ---
generatedBytes = 0;
}
Aggregations