I am trying to understand hashing in python and in particular sha256.
I have a standard python function that uses the hashlib for creating a sha256 hash like this:
import hashlib
def hash_password(password):
    """Hashes a password using the SHA-256 algorithm."""
    hash_object = hashlib.sha256()
    hash_object.update(password.encode('utf-8'))
    return hash_object.hexdigest()
password = 'password123'
hashed_password = hash_password(password)
print(hashed_password)
I was expecting a function with a clear process.
So i navigate the the definition of .sha256() in the hashlib.pyi module to find this:
def sha256(string: ReadableBuffer = b"", *, usedforsecurity: bool = True) -> _Hash: ...
But i simply do not understand what this is doing ?
it looks like a function that takes arguments and does nothing ....
So what does this function do please ?
 
     
    