MCPcopy Index your code
hub / github.com/PyMySQL/PyMySQL / _xor_password

Function _xor_password

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

Source from the content-addressed store, hash-verified

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

Callers 1

sha2_rsa_encryptFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…