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

Function scramble_native_password

pymysql/_auth.py:28–39  ·  view source on GitHub ↗

Scramble used for mysql_native_password

(password, message)

Source from the content-addressed store, hash-verified

26
27
28def scramble_native_password(password, message):
29 """Scramble used for mysql_native_password"""
30 if not password:
31 return b""
32
33 stage1 = sha1_new(password).digest()
34 stage2 = sha1_new(stage1).digest()
35 s = sha1_new()
36 s.update(message[:SCRAMBLE_LENGTH])
37 s.update(stage2)
38 result = s.digest()
39 return _my_crypt(result, stage1)
40
41
42def _my_crypt(message1, message2):

Callers

nothing calls this directly

Calls 1

_my_cryptFunction · 0.85

Tested by

no test coverage detected