MCPcopy Create free account
hub / github.com/PyMySQL/PyMySQL / _xor_password

Function _xor_password

pymysql/_auth.py:124–133  ·  view source on GitHub ↗
(password, salt)

Source from the content-addressed store, hash-verified

122
123
124def _xor_password(password, salt):
125 # Trailing NUL character will be added in Auth Switch Request.
126 # See https://github.com/mysql/mysql-server/blob/7d10c82196c8e45554f27c00681474a9fb86d137/sql/auth/sha2_password.cc#L939-L945
127 salt = salt[:SCRAMBLE_LENGTH]
128 password_bytes = bytearray(password)
129 # salt = bytearray(salt) # for PY2 compat.
130 salt_len = len(salt)
131 for i in range(len(password_bytes)):
132 password_bytes[i] ^= salt[i % salt_len]
133 return bytes(password_bytes)
134
135
136def sha2_rsa_encrypt(password, salt, public_key):

Callers 1

sha2_rsa_encryptFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected