| 1234567891011121314151617181920212223242526272829303132333435363738 |
- #coding=utf-8
- '''
- @attention: 密码加密验证模块
- '''
- import hashlib
- import re
- import common.error_info as ceil
- import random
- def check_password(new,old):
- """
- """
- np = hashlib.md5(new).hexdigest().upper()
- return np==old
- def make_password(pwd,isdefault=None):
- """
- """
- return hashlib.md5(pwd).hexdigest().upper()
- def make_default_password(pwd):
- """
- @attention: 密码加密
- """
- ustr = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
- lstr = "abcdefghjklmnopqrstuvwxyz"
- dstr = "0123456789"
- sstr = "!@#$%&*"
- pwd = "".join(random.sample(ustr,3)+random.sample(lstr,3)+random.sample(dstr,3)+random.sample(sstr,3))
- return pwd,hashlib.md5(pwd).hexdigest().upper()
- if __name__ == '__main__':
- old = "root"
- op = make_password(old)
- print op
- new = "123456"
- # print check_password(new, op)
|