sha (sha1, sha256, sha512)

 

 


SHA256

 

Hardware acceleration

x86

grep sha /proc/cpuinfo

  • sha-ni    # SHA-1 and SHA-256

Speed Test

openssl speed sha256

Doing sha256 for 3s on 16 size blocks: 8812775 sha256's in 3.00s
Doing sha256 for 3s on 64 size blocks: 5731000 sha256's in 3.00s
Doing sha256 for 3s on 256 size blocks: 3072350 sha256's in 3.00s
...

 


SSHA512 vs SHA512

 

SSHA512 = Salted SHA512

    try:
        challenge_bytes = b64decode(challenge_password)
        digest = challenge_bytes[:64]
        salt = challenge_bytes[64:]

        from hashlib import sha512
        hr = sha512(plain_password)
        hr.update(salt)

        return digest == hr.digest()
    except:
        return False

 

 

Creative Commons license icon Creative Commons license icon