diff --git a/data/01.txt b/data/01.txt index 2aaf984..e69de29 100644 --- a/data/01.txt +++ b/data/01.txt @@ -1 +0,0 @@ -49276d206b696c6c696e6720796f757220627261696e206c696b65206120706f69736f6e6f7573206d757368726f6f6d diff --git a/data/02.txt b/data/02.txt deleted file mode 100644 index 3e2d695..0000000 --- a/data/02.txt +++ /dev/null @@ -1,2 +0,0 @@ -1c0111001f010100061a024b53535009181c -686974207468652062756c6c277320657965 diff --git a/data/03.txt b/data/03.txt deleted file mode 100644 index 38b54db..0000000 --- a/data/03.txt +++ /dev/null @@ -1 +0,0 @@ -1b37373331363f78151b7f2b783431333d78397828372d363c78373e783a393b3736 diff --git a/pyproject.toml b/pyproject.toml index f842cef..4d5d47a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "cryptopals" -version = "0.1" +version = "0.0.1" authors = [ { name="Joshua Flores", email="josh@heavyguys.net"}, ] diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index d802289..0000000 --- a/setup.cfg +++ /dev/null @@ -1,24 +0,0 @@ -[metadata] -name = cryptopals -version = 0.1 -author = Joshua Flores -author_email = josh@heavyguys.net -description = Cryptopals Solutions -long_description = file: README.md, LICENSE.txt -long_description_content_type = text/markdown -url = https://git.heavyguys.net/Josh/cryptopals -project_urls = - repository = https://git.heavyguys.net/Josh/cryptopals.git -classifiers = - Programming Language :: Python :: 3 - License :: OSI Approved :: MIT License - Operating System :: OS Independent - -[options] -package_dir = - = src -packages = find: -python_requires = >=3.9 - -[options.packages.find] -where = src diff --git a/src/cryptopals/cryptlib.py b/src/cryptopals/cryptlib.py deleted file mode 100644 index 318821f..0000000 --- a/src/cryptopals/cryptlib.py +++ /dev/null @@ -1,14 +0,0 @@ -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 - -# this function takes two hex strings, converts them to bytes, and xor's them -def byte_xor(bs1, bs2): - byte_array1 = int(bs1,16) - byte_array2 = int(bs2,16) - return byte_array1 ^ byte_array2 diff --git a/src/cryptopals/cryptopals.py b/src/cryptopals/cryptopals.py new file mode 100644 index 0000000..e69de29 diff --git a/src/cryptopals/helper.py b/src/cryptopals/helper.py deleted file mode 100644 index e29e31c..0000000 --- a/src/cryptopals/helper.py +++ /dev/null @@ -1,5 +0,0 @@ -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 cd15344..e69de29 100644 --- a/tests/01.py +++ b/tests/01.py @@ -1,17 +0,0 @@ -#!/usr/bin/env python - -import os, sys - -module_dir = os.path.relpath('../src/cryptopals') -sys.path.insert(0, module_dir) - -import helper, cryptlib - -def main(): - hex_string = helper.read_file("../data/01.txt") - solution = cryptlib.hex_to_base64(hex_string) - print(solution.decode()) - - -if __name__ == '__main__': - main() diff --git a/tests/02.py b/tests/02.py deleted file mode 100644 index e34c999..0000000 --- a/tests/02.py +++ /dev/null @@ -1,17 +0,0 @@ -#!/usr/bin/env python - -import os, sys - -module_dir = os.path.relpath('../src/cryptopals') -sys.path.insert(0, module_dir) - -import helper, cryptlib - -def main(): - content = helper.read_file("../data/02.txt") - hexstring_list = content.splitlines() - solution = cryptlib.byte_xor(hexstring_list[0], hexstring_list[1]) - print(hex(solution)[2:]) - -if __name__ == '__main__': - main() diff --git a/tests/template.py b/tests/template.py deleted file mode 100644 index 1b9b8ae..0000000 --- a/tests/template.py +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env python - -import os, sys - -module_dir = os.path.relpath('../src/cryptopals') -sys.path.insert(0, module_dir) - -import helper, cryptlib - -def main(): - pass - - -if __name__ == '__main__': - main()