Escriu per cercar…

Criptografia

Introducció

Crea un projecte amb el nom crypto:

ps
uv init crypto

Afegeix una dependència amb cryptography:

ps
uv add cryptography

Hash

BLAKE2

BLAKE2 is a cryptographic hash function specified in RFC 7693.

BLAKE2’s design makes it immune to length-extension attacks, an advantage over the SHA-family of hashes.

python
from cryptography.hazmat.primitives import hashes

digest = hashes.Hash(hashes.BLAKE2b(64))
digest.update(b"Tortuga")
digest.update(b"Gallina")
hash = digest.finalize()

print(hash.hex())

El resultat és el hash de TortugaGallina en hexadecimal:

288ed0626f24a06c42b831b41cb6a9e8c8f3b9790c0beaa3bdc1ffb36e739b98d595ec22960f2bc0620604d89d6e64e0127149f9c9600174ea55e10a8524ad2c

Estàs llegint una vista prèvia.

Inicia sessió amb Google per llegir la pàgina completa.

Inicia sessió amb Google

Amb qualsevol compte de Google. Només et demanarem que acceptis les condicions del servei.