MCPcopy Index your code
hub / github.com/Tencent/CodeAnalysis / encrypt

Function encrypt

server/projects/analysis/util/cdcrypto.py:32–41  ·  view source on GitHub ↗

使用key对password明文进行加密

(plain_password, key)

Source from the content-addressed store, hash-verified

30
31
32def 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
44def decrypt(cipher_password, key):

Callers 1

generate_ticketMethod · 0.90

Calls 4

ServerErrorClass · 0.90
__encodeFunction · 0.70
__decodeFunction · 0.70
encryptMethod · 0.45

Tested by

no test coverage detected