md5 

Send to Kindle
home » snippets » dart » md5



Snippets

import "package:crypto/crypto.dart";

String byteToHex(int n) {
  String result = n.toRadixString(16);
  return (result.length < 2) ? "0" + result : result;
}

String md5sum(String text) {
  MD5 md5 = new MD5()..add(text.runes.toList(growable: false));
  return md5.close().map(byteToHex).join();
}

test_md5sum() {
  assert(md5sum("abcdef") == "e80b5017098950fc58aad83c8c14978e");
}