Strobe constructor
Strobe(
- String customizationString,
- StrobeSecParam security
Create a new instance of the Strobe protocol with the specified parameters.
Parameters:
customizationString: A string used to customize the Strobe instance.security: The desired security level (StrobeSecParam.sec128 or StrobeSecParam.sec256); no other value is constructible.
Implementation
factory Strobe(String customizationString, StrobeSecParam security) {
final int rate = (1600 ~/ 8) - security.value ~/ 4;
final Strobe s = Strobe._(
io: 2,
rate: rate,
strober: rate - 2,
posBegin: 0,
curFlags: 0,
storage: List<int>.filled(rate, 0),
buffer: List.empty(growable: true),
);
final List<int> domain = [1, rate, 1, 0, 1, 12 * 8];
domain.addAll(StringUtils.encode(version));
s._duplex(domain, false, false, true);
s._initialized = true;
s.operate(
true,
StrobeOperation.ad,
StringUtils.encode(customizationString),
0,
false,
);
return s;
}