Saturday, June 13, 2026
HomeLanguageshashlib.blake2s() in Python

hashlib.blake2s() in Python

With the help of hashlib.blake2s() method, we can convert the normal string in byte format is converted to an encrypted form. Passwords and important files can be converted into hash to protect them with the help of hashlib.blake2s() method.

Syntax : hashlib.blake2s()

Return : Return the hash code for the string.

Example #1 :
In this example we can see that by using hashlib.blake2s() method, we are able to encrypt the byte string or passwords to protect them by using this method.




# import hashlib
import hashlib
  
# Using hashlib.blake2s() method
gfg = hashlib.blake2s()
gfg.update(b'GeeksForGeeks')
  
print(gfg.digest())


Output :

b’\xb6\x88\x94, \x0fF*\x02\x163\x9e\x1f\\0 \xaa\x8c{\x17\xca\xfc\x14\xc3\xe5n\x89\x8e\xbbV\xf8\xa1\xdb’

Example #2 :




# import hashlib
import hashlib
  
# Using hashlib.blake2s() method
gfg = hashlib.blake2s()
gfg.update(b'xyz@1234_GFG')
  
print(gfg.digest())


Output :

b’\xad\x1bPqk\xbf\xdc\xbb\xea\xb0{j\xdb\x83B!\x14\xb3\xbfT\x03\xfa\xac\x93Zb\xb6\xd3\t\x7f\x14\t’

Dominic
Dominichttp://wardslaus.com
infosec,malicious & dos attacks generator, boot rom exploit philanthropist , wild hacker , game developer,
RELATED ARTICLES

1 COMMENT

Most Popular

Dominic
32515 POSTS0 COMMENTS
Milvus
131 POSTS0 COMMENTS
Nango Kala
6897 POSTS0 COMMENTS
Nicole Veronica
12013 POSTS0 COMMENTS
Nokonwaba Nkukhwana
12109 POSTS0 COMMENTS
Shaida Kate Naidoo
7019 POSTS0 COMMENTS
Ted Musemwa
7262 POSTS0 COMMENTS
Thapelo Manthata
6976 POSTS0 COMMENTS
Umr Jansen
6964 POSTS0 COMMENTS