def c1(): EXAMPLE_INPUT = ('49276d206b696c6c696e6720796f757220627261696e206c696b65206120706f69736f6e6f7573206d757368726f6f6d') EXAMPLE_OUTPUT = 'SSdtIGtpbGxpbmcgeW91ciBicmFpbiBsaWtlIGEgcG9pc29ub3VzIG11c2hyb29t' result = crypto.hex_to_base64(EXAMPLE_INPUT) print(result) expect(result, EXAMPLE_OUTPUT)
def challenge_1(): hex_string = "49276d206b696c6c696e6720796f757220627261696e206c696b65206120706f69736f6e6f7573206d757368726f6f6d" expected_result = "SSdtIGtpbGxpbmcgeW91ciBicmFpbiBsaWtlIGEgcG9pc29ub3VzIG11c2hyb29t" result = crypto.hex_to_base64(hex_string) test(expected_result, result)
def c1(): EXAMPLE_INPUT = \ ('49276d206b696c6c696e6720796f757220627261696e206c' + '696b65206120706f69736f6e6f7573206d757368726f6f6d') EXAMPLE_OUTPUT = \ 'SSdtIGtpbGxpbmcgeW91ciBicmFpbiBsaWtlIGEgcG9pc29ub3VzIG11c2hyb29t' result = crypto.hex_to_base64(EXAMPLE_INPUT) print(result) expect(result, EXAMPLE_OUTPUT)
import base64 import crypto input = "49276d206b696c6c696e6720796f757220627261696e206c696b65206120706f69736f6e6f7573206d757368726f6f6d" print "Hex input:" print input print "Plaintext:" print crypto.hex_to_str(input) print "Encoded" print crypto.hex_to_base64(input)