From 3e1804a427175a54626d004489bb616434a9b730 Mon Sep 17 00:00:00 2001 From: jowj Date: Sun, 9 Sep 2018 13:14:30 -0500 Subject: [PATCH] update to operate more obviously on bytes. --- challenge1.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/challenge1.py b/challenge1.py index a789f48..a39c18e 100644 --- a/challenge1.py +++ b/challenge1.py @@ -1,6 +1,11 @@ from binascii import unhexlify, b2a_base64 +import 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: +hexstring = "49276d206b696c6c696e6720796f757220627261696e206c696b65206120706f69736f6e6f7573206d757368726f6f6d" +bytesThing = bytes.fromhex(hexstring) -result = b2a_base64(unhexlify("49276d206b696c6c696e6720796f757220627261696e206c696b65206120706f69736f6e6f7573206d757368726f6f6d")) -print(result) \ No newline at end of file +result = base64.b64encode(bytesThing) +utfresult = result.decode("utf-8") + +print(utfresult) \ No newline at end of file