Initial commit. Get stuff on github.

master
Josiah Ledbetter 6 years ago
commit 106d61dcbc

@ -0,0 +1,3 @@
{
"python.pythonPath": "/usr/local/bin/python3"
}

@ -0,0 +1 @@
a place to hold my cryptopals attempts and terrible code.

@ -0,0 +1,6 @@
from binascii import unhexlify, b2a_base64
# Use the binascii.unhexlify() function to convert from a hex string to bytes. Then use the binascii.b2a_base64() function to convert that to Base64:
result = b2a_base64(unhexlify("49276d206b696c6c696e6720796f757220627261696e206c696b65206120706f69736f6e6f7573206d757368726f6f6d"))
print(result)

@ -0,0 +1,62 @@
from binascii import unhexlify
# see what each value is unhexlified:
test = bytearray.fromhex("1c0111001f010100061a024b53535009181c").decode()
test2 = bytearray.fromhex("686974207468652062756c6c277320657965").decode()
print(test)
print(test2)
# if converting from strings, you must convert characters to integers and XOR those instead, and then...unconvert them?
# example with XORing integers
input1 = 12345
input2 = 67890
xored1 = input1 ^ input2
print(xored1)
# now prove that worked
print(input1 ^ xored1) # should be = to input2
# now i need to convert strings to integers
text = "suck myass BITCH"
numArray = []
for letter in text:
number = ord(letter)
numArray.append(number)
print(numArray)
# ok now convert that array of ints back to strings
letterArray = []
for number in numArray:
letter = chr(number)
letterArray.append(letter)
print(letterArray)
# OK DOPE now turn it into a function
def xor_TwoEqualLengthBuffers(arg1, arg2):
arg1value = bytearray.fromhex(arg1).decode()
arg2value = bytearray.fromhex(arg2).decode()
numArray1 = []
for letter in arg1value:
number1 = ord(letter)
numArray1.append(number1)
int1 = int(''.join(str(i) for i in numArray1))
numArray2 = []
for letter in arg2value:
number2 = ord(letter)
numArray2.append(number2)
int2 = int(''.join(str(i) for i in numArray2))
xoredValue = int1 ^ int2
xor_TwoEqualLengthBuffers("1c0111001f010100061a024b53535009181c", "686974207468652062756c6c277320657965")
Loading…
Cancel
Save