encode method

Uint8List encode({
  1. Uint8List algorithm(
    1. List<int> message
    )?,
})

Encodes a Message object to a Uint8List. Optionally adds MAC to the field 64.

Implementation

Uint8List encode({Uint8List Function(List<int> message)? algorithm}) {
  final alg = algorithm;

  final fmac = alg != null ? calcmac(alg) : Uint8List(8);

  final bdy = _body();
  final bmp = _bitmap();
  final mt = Uint8List.fromList(hex.decode(mti));

  final xx = mt + bmp + bdy + fmac;
  return Uint8List.fromList(xx);
}