var b = (str.charCodeAt(i) & 0xF0) >> 4; retval += (b <= 9) ? String.fromCharCode(b + 48) : String.fromCharCode((b - 10) + 65); b = str.charCodeAt(i) & 0x0F; retval += (b <= 9) ? String.fromCharCode(b + 48) : String.fromCharCode((b - 10) + 65);