(LDAP__bytes2hex,LDAP__hex2bytes): encode nibbels in the other order

git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@14390 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Love Hörnquist Åstrand
2004-12-12 23:29:42 +00:00
parent cd395c78ad
commit 62b865cdd2

View File

@@ -133,7 +133,7 @@ LDAP__hex2bytes(const char *hex_in, unsigned char *buffer, size_t len)
p = hex_in;
for (i = 0; i < len; i++)
buffer[i] = pos(p[i * 2]) | pos(p[(i * 2) + 1]) << 4;
buffer[i] = pos(p[i * 2]) << 4 | pos(p[(i * 2) + 1]);
return 0;
}
@@ -148,8 +148,8 @@ LDAP__bytes2hex(const char *buffer, size_t buf_len, char **out)
return ENOMEM;
for (i = 0; i < buf_len; i++) {
p[i * 2] = hexchar[(unsigned char)buffer[i] & 0xf];
p[i * 2 + 1] = hexchar[((unsigned char)buffer[i] >> 4) & 0xf];
p[i * 2] = hexchar[((unsigned char)buffer[i] >> 4) & 0xf];
p[i * 2 + 1] = hexchar[(unsigned char)buffer[i] & 0xf];
}
p[i * 2] = '\0';
*out = p;