getSha256HashToString method

String getSha256HashToString(
  1. String publicKey
)

Calculates the SHA-256 hash of a given public key.

Implementation

String getSha256HashToString(String publicKey) {
  final sha256 = SHA256Digest();
  final bytes = utf8.encode(publicKey);
  final digest = sha256.process(Uint8List.fromList(bytes));
  final result = hex.encode(digest);
  return result.replaceAll('-', '').toUpperCase();
}