40 Flutter仿京东商城项目签名验证原理、签名验证算法

加群452892873 下载对应40课文件,运行方法,建好项目,直接替换lib目录

pubspec.yaml

crypto: ^2.1.3

 

SignServices.dart

import 'dart:convert';

import 'package:crypto/crypto.dart';

class SignServices{
  static getSign(){
    Map addressListAttr={
      "uid":'1',
      "age":10,
      "salt":'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' //私钥
    };
    List attrKeys=addressListAttr.keys.toList();
    attrKeys.sort();
    print(attrKeys);
    String str='';
    for(var i=0;i<attrKeys.length;i++){
      str+="${attrKeys[i]}${addressListAttr[attrKeys[i]]}";
    }
    print(str);
    print(md5.convert(utf8.encode(str)));
  }
}

 

posted @ 2019-09-21 07:47  生如逆旅,一苇以航  阅读(814)  评论(0编辑  收藏  举报