md5_util.dart 510 B

12345678910111213141516171819202122
  1. import 'dart:convert';
  2. import 'dart:typed_data';
  3. import 'package:pointycastle/pointycastle.dart';
  4. class Md5Util {
  5. static String encode(String content) {
  6. final md5 = Digest("MD5");
  7. Uint8List output = md5.process(utf8.encode(content) as Uint8List);
  8. var base64EncodedText = base64UrlEncode(output);
  9. return base64EncodedText;
  10. }
  11. }
  12. // void main(List<String> args) {
  13. // String md = Md5Util.encode("http://www.o2oa.net");
  14. // debugPrint("md: $md");
  15. // //md: SGRUBVpjZpE8Un7Ot3WyMw==
  16. // }