Le 17/12/2012 00:20, Stefan Fritsch a écrit :
+AP_DECLARE(void) ap_bin2hex(const void *src, apr_size_t srclen,
char *dest) +{
+ const unsigned char *in = src;
+ unsigned char *out = (unsigned char *)dest;
+ apr_size_t i;
+
+ for (i = 0; i < srclen; i++) {
+ *out++ = c2x_table[in[i] >> 4];
+ *out++ = c2x_table[in[i] & 0xf];
+ }
+ *out = '\0';
+}
+
The following functions:
SSL_SESSION_id2sz, in ssl_util_ssl.c, line 487
socache_mc_id2key, in mod_socache_memcache.c, line 193
log_xlate_error, in mod_charset_lite.c, line 498
add_password, in htdigest.c, line 157
could also benefit from it.
However, some use uppercase HEX representation.
add_password is not an issue.
socache_mc_id2key should not be an issue, the generated string is only
used with apr_memcache_[set|getp|delete].
log_xlate_error should not be an issue, the generated string is only
used for logging.
*But* SSL_SESSION_id2sz could be an issue.
Do you think it could be a win ?
Do you think it would be useful to pass an extra parameter to ap_bin2hex
in order to tell if the conversion should be done using abcdef or ABCDEF ?
Thanks for your comment.
CJ