toEncoded method

String toEncoded([
  1. Uint8List? hashBytes
])

Gets a PHC-compliant encoded string

Implementation

String toEncoded([Uint8List? hashBytes]) {
  var hash = toBase64(salt, codec: Base64Codec.bcrypt);
  if (hashBytes != null) {
    hash += toBase64(hashBytes, codec: Base64Codec.bcrypt);
  }
  return toCrypt(
    CryptDataBuilder(version.name)
        .salt('$cost'.padLeft(2, '0'))
        .hash(hash)
        .build(),
  );
}