From 988d229bcee979449bb43502a6ed93fcb72605d2 Mon Sep 17 00:00:00 2001 From: Joshua Flores Date: Fri, 25 Apr 2025 20:32:42 -0400 Subject: [PATCH] attempt to import local packages --- data/01.txt | 1 + pyproject.toml | 2 +- src/cryptopals/cryptopals.py | 9 +++++++++ src/cryptopals/helper.py | 5 +++++ tests/01.py | 11 +++++++++++ tests/template.py | 5 +++++ 6 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 src/cryptopals/helper.py create mode 100644 tests/template.py diff --git a/data/01.txt b/data/01.txt index e69de29..2aaf984 100644 --- a/data/01.txt +++ b/data/01.txt @@ -0,0 +1 @@ +49276d206b696c6c696e6720796f757220627261696e206c696b65206120706f69736f6e6f7573206d757368726f6f6d diff --git a/pyproject.toml b/pyproject.toml index 4d5d47a..f842cef 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "cryptopals" -version = "0.0.1" +version = "0.1" authors = [ { name="Joshua Flores", email="josh@heavyguys.net"}, ] diff --git a/src/cryptopals/cryptopals.py b/src/cryptopals/cryptopals.py index e69de29..6c0dd6c 100644 --- a/src/cryptopals/cryptopals.py +++ b/src/cryptopals/cryptopals.py @@ -0,0 +1,9 @@ +import base64 + + +# this function takes a string representing hex, converts to bytes, and re-encodes to base64 +def hex_to_base64(hex_string) + byte_array = bytearray.fromhex(hex_string) + base64_value = base64.b64encode(byte_array) + return base64_value + diff --git a/src/cryptopals/helper.py b/src/cryptopals/helper.py new file mode 100644 index 0000000..e29e31c --- /dev/null +++ b/src/cryptopals/helper.py @@ -0,0 +1,5 @@ +def read_file(filepath): + with open(filepath, "r") as file: + content = file.read() + return content + diff --git a/tests/01.py b/tests/01.py index e69de29..5e5a74b 100644 --- a/tests/01.py +++ b/tests/01.py @@ -0,0 +1,11 @@ +#!/usr/bin/env python + +from cryptopals import helper +from cryptopals import cryptopals + +def main(): + pass + + +if __name__ == '__main__': + main() diff --git a/tests/template.py b/tests/template.py new file mode 100644 index 0000000..9369e2e --- /dev/null +++ b/tests/template.py @@ -0,0 +1,5 @@ +def main(): + pass + +if __name__ == '__main__': + main()