Ad
  • Custom User Avatar

    Basically everything you need to do:

    class SHA1:
        def __init__(self) -> None:
            self._message = b''
    
        def update(self, message: bytes) -> None:
            self._message += message
    
        def digest(self) -> bytes:
            """Compute hash for self._message"""
    

    After calling the update(message) method, you update the variable inside the class. When digest() is called, you work with this previously saved variable.
    I checked, scripts of multiple calls to update() are not tested. For a single instance of a class, the update() method is called once.
    p.s. Judging by your code, you are on the right track.