Created
May 6, 2016 07:08
-
-
Save juxtin/bc66d62f0959756d2ab522d3135e0f6f to your computer and use it in GitHub Desktop.
This file contains 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
b64map : [64][8] | |
b64map = ['A' .. 'Z'] # ['a' .. 'z'] # ['0' .. '9'] # ['/', '+'] | |
toB64Char : [6] -> [8] | |
toB64Char x = b64map @ x | |
base64 xs = [ toB64Char x | x <- hexBytes ] | |
where hexBytes = groupBy`{6} xs | |
passes = actual == expected | |
where | |
input = 0x49276d206b696c6c696e6720796f757220627261696e206c696b65206120706f69736f6e6f7573206d757368726f6f6d | |
actual = base64 input | |
expected = "SSdtIGtpbGxpbmcgeW91ciBicmFpbiBsaWtlIGEgcG9pc29ub3VzIG11c2hyb29t" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment