mirror of
https://github.com/ansible-collections/community.mysql.git
synced 2025-08-21 13:31:45 -07:00
add source
This commit is contained in:
parent
35285733de
commit
ed5890524c
1 changed files with 12 additions and 2 deletions
|
@ -1,4 +1,11 @@
|
||||||
"""Generate MySQL sha256 compatible plugins hash for a given password and salt."""
|
"""
|
||||||
|
Generate MySQL sha256 compatible plugins hash for a given password and salt
|
||||||
|
|
||||||
|
based on
|
||||||
|
* https://www.akkadia.org/drepper/SHA-crypt.txt
|
||||||
|
* https://crypto.stackexchange.com/questions/77427/whats-the-algorithm-behind-mysqls-sha256-password-hashing-scheme/111174#111174
|
||||||
|
* https://github.com/hashcat/hashcat/blob/master/tools/test_modules/m07400.pm
|
||||||
|
"""
|
||||||
|
|
||||||
import hashlib
|
import hashlib
|
||||||
|
|
||||||
|
@ -83,7 +90,10 @@ def _sha256_digest(key: str, salt: str, loops: int) -> str:
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
tmp += _to64(
|
tmp += _to64(
|
||||||
(digest_c[i] << 16) | (digest_c[(i + inc1) % mod] << 8) | digest_c[(i + inc1 * 2) % mod], 4
|
(digest_c[i] << 16)
|
||||||
|
| (digest_c[(i + inc1) % mod] << 8)
|
||||||
|
| digest_c[(i + inc1 * 2) % mod],
|
||||||
|
4,
|
||||||
)
|
)
|
||||||
i = (i + inc2) % mod
|
i = (i + inc2) % mod
|
||||||
if i == end:
|
if i == end:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue