使用key对password明文进行加密
(plain_password, key)
| 30 | |
| 31 | |
| 32 | def encrypt(plain_password, key): |
| 33 | """使用key对password明文进行加密""" |
| 34 | if plain_password is None: |
| 35 | return None |
| 36 | if key is None: |
| 37 | raise ServerError(errcode.E_SERVER, "Encrypt key should not be none.") |
| 38 | key = __encode(key) |
| 39 | aes = pyaes.AESModeOfOperationCTR(key) |
| 40 | pwd = b2a_hex(aes.encrypt(plain_password)) |
| 41 | return __decode(pwd) |
| 42 | |
| 43 | |
| 44 | def decrypt(cipher_password, key): |
no test coverage detected