CSHAKEDigest constructor

CSHAKEDigest([
  1. int bitLength = 256,
  2. Uint8List? N,
  3. Uint8List? S
])

Implementation

CSHAKEDigest([int bitLength = 256, Uint8List? N, Uint8List? S]) {
  switch (bitLength) {
    case 128:
    case 256:
      init(bitLength);
      if ((N == null || N.isEmpty) && (S == null || S.isEmpty)) {
        _diff = null;
      } else {
        _diff = concatUint8List([
          XofUtils.leftEncode(rate ~/ 8),
          _encodeString(N),
          _encodeString(S)
        ]);
        _diffPadAndAbsorb();
      }

      break;
    default:
      throw StateError(
          'invalid bitLength ($bitLength) for CSHAKE must only be 128 or 256');
  }
}