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

Commit 166dfd3

Browse files
committed
Add Debug Options
1 parent 38b6bf1 commit 166dfd3

File tree

2 files changed

+26
-20
lines changed

2 files changed

+26
-20
lines changed

lu77U_SHA256/Main.py

Lines changed: 25 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
@click.command()
88
@click.option(
9-
'--text',
9+
'-t', '--text',
1010
help='Input text directly for processing.'
1111
)
1212
@click.option(
@@ -15,7 +15,7 @@
1515
help='Path to a file to read input from.'
1616
)
1717
@click.option(
18-
'--file',
18+
'-f', '--file',
1919
is_flag=True,
2020
help='This option is under construction.'
2121
)
@@ -24,8 +24,13 @@
2424
is_flag=True,
2525
help='Enable custom animation-style print for the output.'
2626
)
27+
@click.option(
28+
'-d', '--debug',
29+
is_flag=True,
30+
help='Enable Debugging - Printing the intermediate steps'
31+
)
2732

28-
def main(text, text_from_file, file, animation):
33+
def main(text, text_from_file, file, animation, debug):
2934
if file:
3035
click.echo("The '--file' option is under construction.")
3136
return
@@ -40,28 +45,29 @@ def main(text, text_from_file, file, animation):
4045
return
4146

4247
padded_input_string = InputPadder(input_string).pad_input()
43-
44-
if animation:
45-
custom_printer = CustomPrint(f"\n\033[33mPadded Input String: \033[0m\033[36m{padded_input_string}\033[0m")
46-
custom_printer.custom_print()
47-
else:
48-
click.echo(f"\nPadded Input String: {padded_input_string}")
49-
48+
if debug:
49+
if animation:
50+
custom_printer = CustomPrint(f"\n\033[33mPadded Input String: \033[0m\033[36m{padded_input_string}\033[0m")
51+
custom_printer.custom_print()
52+
else:
53+
click.echo(f"\n\033[33mPadded Input String: \033[0m\033[36m{padded_input_string}\033[0m")
54+
5055
expanded_message_schedule = InputParser(padded_input_string).process_chunks()
51-
52-
if animation:
53-
custom_printer.text = f"\n\033[33mExpanded Message Schedule: \033[0m\033[36m{expanded_message_schedule}\033[0m"
54-
custom_printer.custom_print()
55-
else:
56-
click.echo(f"\nExpanded Message Schedule: {expanded_message_schedule}")
57-
56+
57+
if debug:
58+
if animation:
59+
custom_printer.text = f"\n\033[33mExpanded Message Schedule: \033[0m\033[36m{expanded_message_schedule}\033[0m"
60+
custom_printer.custom_print()
61+
else:
62+
click.echo(f"\n\033[33mExpanded Message Schedule: \033[0m\033[36m{expanded_message_schedule}\033[0m")
63+
5864
hash_result = MainClass(expanded_message_schedule).hash_message()
59-
65+
6066
if animation:
6167
custom_printer.text = f"\n\033[33mThe Hash Result: \033[0m\033[36m{hash_result}\033[0m"
6268
custom_printer.custom_print()
6369
else:
64-
click.echo(f"\nThe Hash Result: {hash_result}")
70+
click.echo(f"\n\033[33mThe Hash Result: \033[0m\033[36m{hash_result}\033[0m")
6571

6672
if __name__ == '__main__':
6773
main()

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
setup(
44
name="lu77U-SHA256",
5-
version="1.1.4",
5+
version="1.1.5",
66
author="Sam MG Harish",
77
home_page="https://github.com/sam-mg/Python-SHA-256-Implementation",
88
license="Apache Software License 2.0",

0 commit comments

Comments
 (0)