문제풀이/cryptopals

[파이썬] cryptopals 1-1 문제풀이 (Convert hex to base64)

코엽 2016. 1. 15. 00:32

주소

http://cryptopals.com/sets/1/challenges/1/

문제

Convert hex to base64

The string:

49276d206b696c6c696e6720796f757220627261696e206c696b65206120706f69736f6e6f7573206d757368726f6f6d

Should produce:

SSdtIGtpbGxpbmcgeW91ciBicmFpbiBsaWtlIGEgcG9pc29ub3VzIG11c2hyb29t

So go ahead and make that happen. You'll need to use this code for the rest of the exercises.

코드

파이썬 2.7

1
2
string = "49276d206b696c6c696e6720796f757220627261696e206c696b65206120706f69736f6e6f7573206d757368726f6f6d"
print string.decode('hex').encode('base64')

해석

문제의 의도를 모르겠는데 그냥 hex를 base64로 바꿔줍시다.