Strobe constructor

Strobe(
  1. String customizationString,
  2. 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, which can be either 128 or 256 bits.

Throws:

  • CryptoException if the security level is not 128 or 256 bits, indicating an invalid security level.

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(version.codeUnits);

  s._duplex(domain, false, false, true);

  s._initialized = true;
  s.operate(
    true,
    StrobeOperation.ad,
    customizationString.codeUnits,
    0,
    false,
  );

  return s;
}