aboutsummaryrefslogtreecommitdiff
path: root/coreutils/md5_sha1_sum.c
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2007-01-12 22:10:34 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2007-01-12 22:10:34 +0000
commit3a34d0c08a77ee48edc3f4353cc49b95aba85c2f (patch)
tree09708579e18a033c6722c5194c46116705f47b83 /coreutils/md5_sha1_sum.c
parent21b080daa8c180a43d10d6b3dee47134ef21e581 (diff)
downloadbusybox-w32-3a34d0c08a77ee48edc3f4353cc49b95aba85c2f.tar.gz
busybox-w32-3a34d0c08a77ee48edc3f4353cc49b95aba85c2f.tar.bz2
busybox-w32-3a34d0c08a77ee48edc3f4353cc49b95aba85c2f.zip
random small size optimizations
Diffstat (limited to 'coreutils/md5_sha1_sum.c')
-rw-r--r--coreutils/md5_sha1_sum.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/coreutils/md5_sha1_sum.c b/coreutils/md5_sha1_sum.c
index 6fe1b0286..014ecefd0 100644
--- a/coreutils/md5_sha1_sum.c
+++ b/coreutils/md5_sha1_sum.c
@@ -18,11 +18,9 @@ typedef enum { HASH_SHA1, HASH_MD5 } hash_algo_t;
18static unsigned char *hash_bin_to_hex(unsigned char *hash_value, 18static unsigned char *hash_bin_to_hex(unsigned char *hash_value,
19 unsigned hash_length) 19 unsigned hash_length)
20{ 20{
21 int len = 0; 21 /* xzalloc zero-terminates */
22 char *hex_value = xmalloc((hash_length * 2) + 2); 22 char *hex_value = xzalloc((hash_length * 2) + 1);
23 while (hash_length--) { 23 bin2hex(hex_value, (char*)hash_value, hash_length);
24 len += sprintf(hex_value + len, "%02x", *hash_value++);
25 }
26 return hex_value; 24 return hex_value;
27} 25}
28 26