g BdZddlZddlZddlmZmZmZGddeZy)z.Implementation of MySQL Authentication Plugin.N)PY3 UNICODE_TYPEShexlifyc*eZdZdZdZdZdZdZy)MySQL41AuthPlugincn||_t|tr|jd|_y||_y)Nzutf-8) _username isinstancerencode _password)selfusernamepasswords l/opt/hc_python/lib64/python3.12/site-packages/../../../lib/python3.12/site-packages/mysqlx/authentication.py__init__zMySQL41AuthPlugin.__init__!s/!(M2"18@ cy)NzMySQL 4.1 Authentication Pluginrs rnamezMySQL41AuthPlugin.name&s0rcy)NMYSQL41rrs r auth_namezMySQL41AuthPlugin.auth_name)srctr"t||Dcgc] \}}||z  }}}n3t||Dcgc]\}}t|t|z }}}tjdg|Scc}}wcc}}w)zmEncrypt/Decrypt function used for password encryption in authentication, using a simple XOR. 20B)rzipordstructpack)rhash1hash2h1h2xoreds r xor_stringzMySQL41AuthPlugin.xor_string,sw -0->?->"bR"W->E?7:5%7HI7H8BSWs2w&7HEI{{5)5))@Is A2!A8c|jrtj|jj}tj|j}|j |tj||zj}dj d|j t|Sdj d|j S)z-Hashing for MySQL 4.1 authentication z {0}{1}*{2}z{0}{1})r hashlibsha1digestr&formatr r)rdatar#r$ auth_responses rbuild_authentication_responsez/MySQL41AuthPlugin.build_authentication_response6s >>dnn-446Bb!((*B OOGLL+2246M%,,R-4]-CE E &&r4>>: :rN)__name__ __module__ __qualname__rrrr&r/rrrrr sA 1* ;rr) __doc__r)rcompatrrrobjectrrrrr6s"05 //!;!;r