convert method

  1. @override
String convert(
  1. CryptData input
)
override

Converts input and returns the result of the conversion.

Implementation

@override
String convert(CryptData input) {
  input.validate();
  String result = '\$${input.id}';
  if (input.version != null && input.version!.isNotEmpty) {
    result += '\$v=${input.version!}';
  }
  if (input.params != null && input.params!.isNotEmpty) {
    result += '\$';
    result += input.params!.entries
        .map((entry) => '${entry.key}=${entry.value}')
        .join(',');
  }
  if (input.salt != null && input.salt!.isNotEmpty) {
    result += '\$';
    result += input.salt!;
  }
  if (input.hash != null && input.hash!.isNotEmpty) {
    result += '\$';
    result += input.hash!;
  }
  return result;
}