about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorphoebos <ben@bvnf.space>2021-07-06 20:27:15 +0100
committerphoebos <ben@bvnf.space>2021-07-06 20:27:15 +0100
commit0b5f803354afe70a0648882e26078374bc4d9fc4 (patch)
treef69c41ef5576ffcfe167eb544b02f7c25800f1c9
parentbc4022292b3366ef3f4dfbdd1347aa15c8297e83 (diff)
downloadkandr-0b5f803354afe70a0648882e26078374bc4d9fc4.tar.gz
base64: add lookup table
-rw-r--r--base64.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/base64.c b/base64.c
index ce4f4c7..5af13a7 100644
--- a/base64.c
+++ b/base64.c
@@ -26,6 +26,18 @@
 
 #define BUF_SIZE 1000
 
+const char tbl_base64[] = {
+        'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H',
+        'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P',
+        'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X',
+        'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f',
+        'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n',
+        'o', 'p', 'q', 'r', 's', 't', 'u', 'v',
+        'w', 'x', 'y', 'z', '0', '1', '2', '3',
+        '4', '5', '6', '7', '8', '9', '+', '/',
+        '=' /* termination character */
+};
+
 static void usage(const char *name) {
     fprintf(stderr, "usage: %s [-d] [FILE]\n", name);
 }