1
如何從字符串生成md5散列?飛鏢MD5從字符串
import 'package:crypto/crypto.dart' as crypto;
///Generate MD5 hash
generateMd5(String data) {
var content = UTF8.encode(data);
var md5 = crypto.md5;
}
我不知道該怎麼
如何從字符串生成md5散列?飛鏢MD5從字符串
import 'package:crypto/crypto.dart' as crypto;
///Generate MD5 hash
generateMd5(String data) {
var content = UTF8.encode(data);
var md5 = crypto.md5;
}
我不知道該怎麼
何去何從找到了答案:
import 'dart:convert';
import 'package:convert/convert.dart';
import 'package:crypto/crypto.dart' as crypto;
///Generate MD5 hash
generateMd5(String data) {
var content = new Utf8Encoder().convert(data);
var md5 = crypto.md5;
var digest = md5.convert(content);
return hex.encode(digest.bytes);
}