Converting ASCII to hex

So change the

  hex[i] = (toHex(text[i * 2]) << 8) | toHex(text[i * 2 + 1]);

to

  hex[i] = (toHex(text[i * 2]) << 4) | toHex(text[i * 2 + 1]);
char text[] = "1122334455667788";
char hex[8];

void foo() {
  for (int i = 0; i < 8; i++) {
    hex[i] = (toHex(text[i * 2]) << 4) | toHex(text[i * 2 + 1]);
  }
}
inline byte toHex(char z) {
  return z <= '9' ? z - '0' :  z <= 'F' ? z - 'A' + 10 : z - 'a' + 10;
}

void setup() {
  Serial.begin(250000);
  foo();
  dump(&text, sizeof(text));
  dump(&hex, sizeof(hex));
}

void loop() {}

void dump(const void* adrIn, int len) {
  byte* adr = (byte*) adrIn;
  byte idx;
  byte blanks;
  if (len) {
    for (; len > 0; len -= 16, adr += 16) {
      phAdr(adr);
      for (idx = 0; idx < 16; idx++) {
        if (idx < len ) {
          byte curr = adr[idx];
          phByte(curr);
          blanks = 1;
        } else {
          blanks = 3;
        }
        while (blanks--) {
          Serial.write(' ');
        }
      }
      Serial.write('\'');
      for (idx = 0; (idx < 16) && (idx < len); idx++) {
        byte curr = adr[idx];
        Serial.write(curr < 0x20 ? '.' : curr);
      }
      Serial.write('\'');
      Serial.println();
    }
  }
}

void phByte(byte value) {
  if (value < 16) {
    Serial.write('0');
  }
  Serial.print(value, HEX);
}

void phAdr(const byte* adr) {
  phByte((byte)(((uint16_t)adr) >> 8));
  phByte((uint16_t)adr);
  Serial.write(':');
  Serial.write(' ');
}
0200: 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 '1122334455667788'
0210: 00                                              '.'
0226: 11 22 33 44 55 66 77 88                         '."3DUfwˆ'