Submission a3e6728d...

ChallengeHex decoder
Submitterricmoo.firefly.eth
Submitted at2018-14-30
Gas used1607736
contract HexDecoder {
    function decode(string input) pure public returns(bytes output) {
        output = new bytes(bytes(input).length / 2);
        for(uint i = 0; i < output.length; i++) {
            uint a = uint(bytes(input)[i * 2]);
            uint b = uint(bytes(input)[i * 2 + 1]);
            output[i] = byte(
                ((a + (((a & 0x40) + 1) / 7)) << 4) | ((b & 0x0f) + (((b & 0x40) + 1) / 7))
            );
        }
    }
}