Skip to content

Instantly share code, notes, and snippets.

@NMelis
Created May 22, 2018 13:11
Show Gist options
  • Save NMelis/3499a6a151cd9d949c4d49a1fb80f1fd to your computer and use it in GitHub Desktop.
Save NMelis/3499a6a151cd9d949c4d49a1fb80f1fd to your computer and use it in GitHub Desktop.
from pbkdf2 import PBKDF2
import base64
password_hash = b"AJeaF8lqg6tG24CAAJT6GbRwBi3GafdU5XnWnhxwIjTxo/q1yc1cnJa2PCplxUF3Rg=="
password = b"123456"
# оригинальный Соль
origin_salt = base64.b64decode(password_hash)[1:16]
print(base64.b64encode(origin_salt))
# > l5oXyWqDq0bbgIAAlPoZ
# оригинальный буфер
buffer1 = base64.b64decode(password_hash)[17:]
print(base64.b64encode(buffer1))
# > cAYtxmn3VOV51p4ccCI08aP6tcnNXJyWtjwqZcVBd0Y=
current_password_hash = PBKDF2(password, origin_salt)
# Соль с нового хеша
print(base64.b64encode(current_password_hash._PBKDF2__salt))
# > l5oXyWqDq0bbgIAAlPoZ
# Буфер с нового хеша
print(base64.b64encode(current_password_hash.read(49)[17:]))
# > 2n+kU1j80wyp+czeQRiqK5DiVPsg52zG7AfpUNJCleo=
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment