code: def hash(self, val):
          
  
          if not isinstance(val, bytes):
              raise _TypeError("val", "bytes", val)
  
          rv = self.compute(val)
  
          if not isinstance(val, bytes):
              raise _TypeError("val", "bytes", rv)
  
          return rv
docs: Calculate hash from value (must be bytes).