Skip to content

Commit

Permalink
make flake8 happy
Browse files Browse the repository at this point in the history
  • Loading branch information
exiledkingcc committed Jul 25, 2022
1 parent 8661b1a commit 1e7b324
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions PyPDF2/_encryption.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ def compute_key(
u_hash.update(o_entry)
u_hash.update(struct.pack("<I", P))
u_hash.update(id1_entry)
if rev >= 4 and metadata_encrypted == False:
if rev >= 4 and metadata_encrypted is False:
u_hash.update(b"\xff\xff\xff\xff")
u_hash_digest = u_hash.digest()
length = key_size // 8
Expand Down Expand Up @@ -772,7 +772,9 @@ def verify_v4(self, password: bytes) -> Tuple[bytes, PasswordType]:
R = cast(int, self.entry["/R"])
P = cast(int, self.entry["/P"])
P = (P + 0x100000000) % 0x100000000 # maybe < 0
metadata_encrypted = self.entry.get("/EncryptMetadata", True)
# make type(metadata_encrypted) == bool
em = self.entry.get("/EncryptMetadata")
metadata_encrypted = em.value if em else True
o_entry = cast(ByteStringObject, self.entry["/O"].get_object()).original_bytes
u_entry = cast(ByteStringObject, self.entry["/U"].get_object()).original_bytes

Expand Down

0 comments on commit 1e7b324

Please sign in to comment.