diff --git a/pypdf/generic/_base.py b/pypdf/generic/_base.py index 0982d5891..ebc2d5763 100644 --- a/pypdf/generic/_base.py +++ b/pypdf/generic/_base.py @@ -72,15 +72,12 @@ def hash_bin(self) -> int: ) def hash_value_data(self) -> bytes: - return ("%s" % self).encode() + return f"{self}".encode() def hash_value(self) -> bytes: return ( - "%s:%s" - % ( - self.__class__.__name__, - self.hash_func(self.hash_value_data()).hexdigest(), - ) + f"{self.__class__.__name__}:" + f"{self.hash_func(self.hash_value_data()).hexdigest()}" ).encode() def replicate(