0xBF
0xBF

0xBF

Calculate sha256 hash in dart

0xBF's photo
0xBF

Published on May 3, 2021

1 min read

Use the crypto package we can calculate sha hash:

Install:

$ dart pub add crypto

Example:

import 'dart:convert';
import 'package:crypto/crypto.dart';

String sha256hash(String s) {
  var bytes = utf8.encode(s); // data being hashed
  return sha256.convert(bytes).toString();
}

Reference

 
Share this