Skip to content

Commit 536e69e

Browse files
authored
Fixed base.py
fixed that sometimes it gives too many pads ("=")
1 parent 5d28a11 commit 536e69e

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

base.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,17 @@ def enc():
5353
x = input("input pls right here: ")
5454
x = x.encode('utf-8')
5555
x = ''.join(format(byte, '08b') for byte in x)
56+
print(x)
5657
leng = len(x)
58+
print(leng)
5759
mod = leng % 6
60+
print(mod)
5861
if mod != 0:
59-
pad = leng % 6
62+
pad = 6 - mod
63+
else:
64+
pad = 0
65+
if pad != 0:
66+
print(pad)
6067
for _ in range (pad):
6168
x += "00"
6269
length = len(x)
@@ -84,7 +91,8 @@ def enc():
8491
letter = var.decode()
8592
result += letter
8693
l += 6
87-
for _ in range (mod):
94+
pad = int(pad/2)
95+
for _ in range (pad):
8896
result += "="
8997
print(result)
9098
if __name__ == "__main__":

0 commit comments

Comments
 (0)