encode method

GGDigest? encode(
  1. dynamic any
)

Implementation

GGDigest? encode(dynamic any) {
  List<int> bytes;
  if (any is Map<String, dynamic>) {
    bytes = convert.utf8.encode(convert.json.encode(any));
  } else if (any is String) {
    bytes = convert.utf8.encode(any);
  } else if (any is List<int>) {
    bytes = any;
  } else {
    return null;
  }

  bytes = gzip.encode(bytes);

  final data = _encrypter.encryptBytes(bytes, iv: _iv);
  final sig = _sig.convert(data.bytes).toString();
  return GGDigest(data.bytes, sig);
}