Created
February 21, 2018 15:13
-
-
Save Hwatwasthat/26e470be690266f77351c92ea7699f3c to your computer and use it in GitHub Desktop.
Hex to base64 created by Hwatwasthat - https://repl.it/@Hwatwasthat/Hex-to-base64
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import base64 | |
b = '49276d206b696c6c696e6720796f757220627261696e206c696b65206120706f69736f6e6f7573206d757368726f6f6d' | |
def hex_to_base64(input): | |
# convert hex to bytearray | |
result = bytearray.fromhex(input) | |
# convert bytearray to base64 | |
a = base64.b64encode(result) | |
# strip out parts at either end of a, the b' and ' symbology | |
a = str(a).strip("'b'") | |
return a | |
print (hex_to_base64(b)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import base64 | |
def hex_to_base64(input): | |
result = bytearray.fromhex(input) | |
result = base64.b64encode(result) | |
result = str(result).strip("'b'") | |
return result |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment