]> granicus.if.org Git - apache/commitdiff
more simplification with ap_bin2hex()
authorStefan Fritsch <sf@apache.org>
Mon, 18 Mar 2013 21:34:37 +0000 (21:34 +0000)
committerStefan Fritsch <sf@apache.org>
Mon, 18 Mar 2013 21:34:37 +0000 (21:34 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1458020 13f79535-47bb-0310-9956-ffa450edef68

modules/aaa/mod_auth_digest.c

index 65183160335ce0cb93876133d1888ea0ba87fc3b..d718e2c65c702a6436dec73bcbed66b0d93bc204 100644 (file)
@@ -1056,10 +1056,8 @@ static void gen_nonce_hash(char *hash, const char *timestr, const char *opaque,
                            const server_rec *server,
                            const digest_config_rec *conf)
 {
-    const char *hex = "0123456789abcdef";
     unsigned char sha1[APR_SHA1_DIGESTSIZE];
     apr_sha1_ctx_t ctx;
-    int idx;
 
     memcpy(&ctx, &conf->nonce_ctx, sizeof(ctx));
     /*
@@ -1075,12 +1073,7 @@ static void gen_nonce_hash(char *hash, const char *timestr, const char *opaque,
     }
     apr_sha1_final(sha1, &ctx);
 
-    for (idx=0; idx<APR_SHA1_DIGESTSIZE; idx++) {
-        *hash++ = hex[sha1[idx] >> 4];
-        *hash++ = hex[sha1[idx] & 0xF];
-    }
-
-    *hash++ = '\0';
+    ap_bin2hex(sha1, APR_SHA1_DIGESTSIZE, hash);
 }