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

Commit a7533f8

Browse files
committed
Add version 1.1
1 parent c21bfa1 commit a7533f8

File tree

3 files changed

+98
-10
lines changed

3 files changed

+98
-10
lines changed

.github/workflows/python-package.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Build and Publish Python Package
2+
3+
on:
4+
workflow_dispatch:
5+
6+
jobs:
7+
python-build-&-publish:
8+
name: Build and publish Python package
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- uses: actions/checkout@v2
13+
name: Checkout code
14+
15+
- name: Set up Python 3.9
16+
uses: actions/setup-python@v2
17+
with:
18+
python-version: 3.9
19+
20+
- name: Install local modules
21+
run: |
22+
python -m pip install --upgrade pip
23+
pip install -e ./
24+
pip install flake8
25+
26+
- name: Lint with flake8
27+
run: |
28+
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
29+
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
30+
31+
- name: Run the script for testing
32+
run: |
33+
python Main.py --text "Sample input for testing"
34+
35+
- name: Build source distribution and wheel
36+
run: |
37+
python setup.py sdist bdist_wheel
38+
39+
- name: Publish distribution to PyPI
40+
uses: pypa/gh-action-pypi-publish@master
41+
with:
42+
password: ${{ secrets.PYPI__Custom_Package_Upload__API_Token }}
43+
repository_url: https://upload.pypi.org/legacy/

Main.py

Lines changed: 38 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,45 @@
1+
import click
12
from Input_Padder import InputPadder
23
from Padded_Parser import InputParser
34
from Main_Class import MainClass
45

5-
input_string = str(input("Enter the data: "))
6+
@click.command()
7+
@click.option(
8+
'--text',
9+
help='Input text directly for processing.'
10+
)
11+
@click.option(
12+
'--text_from_file',
13+
type=click.Path(exists=True),
14+
help='Path to a file to read input from.'
15+
)
16+
@click.option(
17+
'--file',
18+
is_flag=True,
19+
help='This option is under construction.'
20+
)
21+
def main(text, text_from_file, file):
22+
if file:
23+
click.echo("The '--file' option is under construction.")
24+
return
25+
26+
if text:
27+
input_string = text
28+
elif text_from_file:
29+
with open(text_from_file, 'r') as f:
30+
input_string = f.read()
31+
else:
32+
click.echo("Please provide input using either --text or --text_from_file.")
33+
return
34+
35+
padded_input_string = InputPadder(input_string).pad_input()
36+
click.echo(f"Padded Input String: {padded_input_string}")
637

7-
padded_input_string = InputPadder(input_string).pad_input()
38+
expanded_message_schedule = InputParser(padded_input_string).process_chunks()
39+
click.echo(f"Expanded Message Schedule: {expanded_message_schedule}")
840

9-
print("Padded Input String: ", padded_input_string)
41+
hash_result = MainClass(expanded_message_schedule).hash_message()
42+
click.echo(f"The Hash Result: {hash_result}")
1043

11-
expanded_message_schedule = InputParser(padded_input_string).process_chunks()
12-
13-
print("Expanded Message Schedule: ", expanded_message_schedule)
14-
15-
hash_result = MainClass(expanded_message_schedule).hash_message()
16-
17-
print("The Hash Result: ", hash_result)
44+
if __name__ == '__main__':
45+
main()

setup.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
from setuptools import setup, find_packages
2+
3+
setup(
4+
name="lu77U-SHA256",
5+
version="1.1",
6+
author="Sam MG Harish",
7+
author_email="sammgharish@gmail.com",
8+
description="An Fully Manual SHA-256 Hasher",
9+
packages=find_packages(),
10+
classifiers=[
11+
"Programming Language :: Python :: 3",
12+
"License :: OSI Approved :: Apache Software License",
13+
"Operating System :: OS Independent",
14+
],
15+
install_requires=["click", "struct"],
16+
entry_points={"console_scripts": ["lu77U-SHA256 = Main:main"]},
17+
)

0 commit comments

Comments
 (0)