summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNiels Möller <nisse@lysator.liu.se>2003-04-22 21:54:09 +0200
committerNiels Möller <nisse@lysator.liu.se>2003-04-22 21:54:09 +0200
commit9f3ff09fd8cbc67310ff6ceb2e0e58a52548dc59 (patch)
treee49269856317ad211b83915bf59ec56ce18df3d2
parent8dfc66bf0a1d1a2f6f9ebbbfe2dd4eef81e8f612 (diff)
downloadnettle-9f3ff09fd8cbc67310ff6ceb2e0e58a52548dc59.tar.gz
* sha-example.c (display_hex): Simplified by using printf better.
Rev: src/nettle/ChangeLog:1.191 Rev: src/nettle/sha-example.c:1.2
-rw-r--r--ChangeLog3
-rw-r--r--sha-example.c7
2 files changed, 5 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index 6b939b6e..de9b4a8d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,9 +1,12 @@
2003-04-22 Niels Möller <nisse@cuckoo.hack.org>
+ * sha-example.c (display_hex): Simplified by using printf better.
+
* nettle.texinfo (Example): Use @verbatiminclude to include the
example program.
* sha-example.c: Example program, for inclusion in the manual.
+ Fixed bugs reported by Mark Arking.
2003-04-14 Niels Möller <niels@s3.kth.se>
diff --git a/sha-example.c b/sha-example.c
index a4818460..8f434968 100644
--- a/sha-example.c
+++ b/sha-example.c
@@ -8,14 +8,11 @@
static void
display_hex(unsigned length, uint8_t *data)
{
- static const char digits[16] = "0123456789abcdef";
unsigned i;
for (i = 0; i<length; i++)
- {
- uint8_t byte = data[i];
- printf("%c%c ", digits[(byte / 16) & 0xf], digits[byte & 0xf]);
- }
+ printf("%2x ", data[i]);
+
printf("\n");
}