hashlib 文件校验 # for循环校验 import hashlib def check_md5(file): ret = hashlib.md5() with open(file, mode='rb') as f1: for line in f1: ret.update(line) return ret.hexdigest() print(check_md5('rock1')) print(check_md5('rock')) print(check_md5('rock1') == ch
项目中用到js MD5加密和后台java MD5加密,刚开始加密后两个不一致,网上找了好久终于找到一个啦,记下来: md5.js /* * A JavaScript implementation of the RSA Data Security, Inc. MD5 Message * Digest Algorithm, as defined in RFC 1321. * Version 2.1 Copyright (C) Paul Johnston 1999 - 2002. * Other co