Skip to content
This repository was archived by the owner on Jun 4, 2025. It is now read-only.

Commit a815e28

Browse files
committed
Added Input_Padder
1 parent 4d0c405 commit a815e28

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

Input_Padder.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import struct
2+
3+
class InputPadder:
4+
def __init__(self, data):
5+
self.data = data.encode()
6+
7+
def pad_input(self):
8+
bit_length = len(self.data) * 8
9+
self.data += b'\x80'
10+
11+
while (len(self.data)*8) % 512 != 448:
12+
self.data += b'\x00'
13+
14+
self.data += struct.pack('>Q', bit_length)
15+
16+
return self.data

Main.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
from Input_Padder import InputPadder
2+
3+
input_string = str(input("Enter the data: "))
4+
5+
padded_input_string = InputPadder(input_string).pad_input()
6+
7+
print("Padded Input String: ", padded_input_string)

0 commit comments

Comments
 (0)