Skip to content

Commit

Permalink
adds a ValueError to encrypt if message is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
WolfgangFahl committed Oct 23, 2024
1 parent 2228e02 commit 163c0c8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion wikibot3rd/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.13.2"
__version__ = "0.13.3"
4 changes: 3 additions & 1 deletion wikibot3rd/crypt.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,12 @@ def getCrypt(self):
iv = result[8:16]
return DES.new(key, DES.MODE_CBC, iv)

def encrypt(self, msg):
def encrypt(self, msg:str):
"""
encrypt the given message
"""
if not msg:
ValueError("encrypt needs something to encrypt")
plaintext_to_encrypt = msg
# Pad plaintext per RFC 2898 Section 6.1
padding = 8 - len(plaintext_to_encrypt) % 8
Expand Down

0 comments on commit 163c0c8

Please sign in to comment.