Last active
April 23, 2020 08:38
-
-
Save PaburoTC/7c07ddbde8aafca0774ead2a8da826a2 to your computer and use it in GitHub Desktop.
Pad&UnPad
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def __pad(self, plain_text): | |
number_of_bytes_to_pad = self.block_size - len(plain_text) % self.block_size | |
ascii_string = chr(number_of_bytes_to_pad) | |
padding_str = number_of_bytes_to_pad * ascii_string | |
padded_plain_text = plain_text + padding_str | |
return padded_plain_text | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment