phc-winner-argon2、argon2-cffi安装使用方法

Argon2 is a password-hashing function created by by Alex Biryukov, Daniel Dinu, and Dmitry Khovratovich.

Argon2算法曾在2015 年的Password Hashing密码加密大赛中胜出。

Argon2官网:https://www.argon2.com/

------------------------------------------------------------------------

0x00 phc-winner-argon2的安装

git clone https://github.com/P-H-C/phc-winner-argon2
cd phc-winner-argon2
make

使用方法:

echo -n "CTF_110_911" | ./argon2 12345678 -d -t 100 -m 15 -p 1 -l 64

 

0x01 argon2-cffi的安装

CFFI: C Foreign Function Interface for Python. Interact with almost any C code from Python, based on C-like declarations that you can often copy-paste from header files or documentation.

pip install argon2_cffi

请不要安装pip install argon2

argon2-cffi的github:https://github.com/hynek/argon2-cffi (由于总更新,不建议从此安装)

argon2-cffi文档:https://argon2-cffi.readthedocs.io/en/stable/

 

0x02 argon2-cffi的使用

# -*- coding:utf8 -*-
__author__='pcat@chamd5.org'

from argon2 import PasswordHasher

ph=PasswordHasher()
hash='$argon2d$v=19$m=32768,t=100,p=1$MTIzNDU2Nzg$iuSRO5tkWxBxqgkI5g9O5ZersA//xvgvrKxH8QuxBBI4yKbG4aRFqITP/Rh5giFRuL9PTJP+/0BUfNwZHzx9bQ'
pwd='CTF_110_911'
assert ph.verify(hash,pwd)==True

 

0x03 argon2的各个版本

  • Argon2d 最大限度地提高了对GPU破解攻击的抵抗力。它以密码相关的顺序访问存储器阵列,这降低了时间 - 存储器权衡(TMTO)攻击的可能性,但是引入了可能的侧面信道攻击。
  • Argon2i 优化了抵御侧向通道攻击的能力。它以密码无关的顺序访问内存阵列。
  • Argon2id 是一个混合版本。它遵循Argon2i方法进行第一次通过内存,Argon2d方法用于后续通过。Internet-Draft建议使用Argon2id,除非有理由选择其他两种模式之一。

 

posted @ 2019-09-11 17:31  pcat  阅读(2445)  评论(0编辑  收藏  举报