MCPcopy Create free account
hub / github.com/Tencent/CodeAnalysis / encrypt

Function encrypt

server/projects/main/util/cdcrypto.py:36–45  ·  view source on GitHub ↗

使用key对password明文进行加密

(plain_password, key)

Source from the content-addressed store, hash-verified

34
35
36def encrypt(plain_password, key):
37 """使用key对password明文进行加密"""
38 if plain_password is None or plain_password == "":
39 return plain_password
40 if key is None:
41 raise ServerError(errcode.E_SERVER, "Encrypt key should not be none.")
42 key = __encode(key)
43 aes = pyaes.AESModeOfOperationCTR(key)
44 pwd = b2a_hex(aes.encrypt(plain_password))
45 return __decode(pwd)
46
47
48def decrypt(cipher_password, key):

Callers 15

validate_scm_passwordMethod · 0.90
validate_scm_passwordMethod · 0.90
validate_git_tokenMethod · 0.90
validate_passwordMethod · 0.90
validate_client_idMethod · 0.90
refresh_tokenMethod · 0.90

Calls 4

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

Tested by

no test coverage detected