From 62b865cdd2752ae1b1363cddf5d46cc8ac4bf9c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Love=20H=C3=B6rnquist=20=C3=85strand?= Date: Sun, 12 Dec 2004 23:29:42 +0000 Subject: [PATCH] (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 --- lib/hdb/hdb-ldap.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/hdb/hdb-ldap.c b/lib/hdb/hdb-ldap.c index 2f98ec8df..532263b8a 100644 --- a/lib/hdb/hdb-ldap.c +++ b/lib/hdb/hdb-ldap.c @@ -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;