summaryrefslogtreecommitdiff
path: root/plugins/CryptoPP/src/base16.h
diff options
context:
space:
mode:
authorKirill Volinsky <mataes2007@gmail.com>2012-07-20 16:21:49 +0000
committerKirill Volinsky <mataes2007@gmail.com>2012-07-20 16:21:49 +0000
commitf424a18112032cf61d2871a6b91a5af607c171ae (patch)
tree88fedc4e28941ceecda7026f0b06eba6271f91d5 /plugins/CryptoPP/src/base16.h
parentbfe1bd0fc087be44c70904aee0fe4276643d206d (diff)
CryptoPP:
changed folder structure git-svn-id: http://svn.miranda-ng.org/main/trunk@1083 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/CryptoPP/src/base16.h')
-rw-r--r--plugins/CryptoPP/src/base16.h53
1 files changed, 53 insertions, 0 deletions
diff --git a/plugins/CryptoPP/src/base16.h b/plugins/CryptoPP/src/base16.h
new file mode 100644
index 0000000000..2a2c18c42a
--- /dev/null
+++ b/plugins/CryptoPP/src/base16.h
@@ -0,0 +1,53 @@
+#ifndef __BASE_16__
+#define __BASE_16__
+
+#define BERR 0xFF /* Illegal char marker */
+#define BEOF 0x7F /* EOF marker (padding char or EOL) */
+
+typedef unsigned char byte;
+
+static const byte asciiToBin16[] =
+ { BERR, BERR, BERR, BERR, BERR, BERR, BERR, BERR,
+ BERR, BERR, BEOF, BERR, BERR, BEOF, BERR, BERR,
+ BERR, BERR, BERR, BERR, BERR, BERR, BERR, BERR,
+ BERR, BERR, BERR, BERR, BERR, BERR, BERR, BERR,
+ BERR, BERR, BERR, BERR, BERR, BERR, BERR, BERR,
+ BERR, BERR, BERR, BERR, BERR, BERR, BERR, BERR,
+ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
+ 0x08, 0x09, BERR, BERR, BERR, BEOF, BERR, BERR,
+ BERR, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, BERR,
+ BERR, BERR, BERR, BERR, BERR, BERR, BERR, BERR,
+ BERR, BERR, BERR, BERR, BERR, BERR, BERR, BERR,
+ BERR, BERR, BERR, BERR, BERR, BERR, BERR, BERR,
+ BERR, BERR, BERR, BERR, BERR, BERR, BERR, BERR,
+ BERR, BERR, BERR, BERR, BERR, BERR, BERR, BERR,
+ BERR, BERR, BERR, BERR, BERR, BERR, BERR, BERR,
+ BERR, BERR, BERR, BERR, BERR, BERR, BERR, BERR,
+ BERR, BERR, BERR, BERR, BERR, BERR, BERR, BERR,
+ BERR, BERR, BERR, BERR, BERR, BERR, BERR, BERR,
+ BERR, BERR, BERR, BERR, BERR, BERR, BERR, BERR,
+ BERR, BERR, BERR, BERR, BERR, BERR, BERR, BERR,
+ BERR, BERR, BERR, BERR, BERR, BERR, BERR, BERR,
+ BERR, BERR, BERR, BERR, BERR, BERR, BERR, BERR,
+ BERR, BERR, BERR, BERR, BERR, BERR, BERR, BERR,
+ BERR, BERR, BERR, BERR, BERR, BERR, BERR, BERR,
+ BERR, BERR, BERR, BERR, BERR, BERR, BERR, BERR,
+ BERR, BERR, BERR, BERR, BERR, BERR, BERR, BERR,
+ BERR, BERR, BERR, BERR, BERR, BERR, BERR, BERR,
+ BERR, BERR, BERR, BERR, BERR, BERR, BERR, BERR,
+ BERR, BERR, BERR, BERR, BERR, BERR, BERR, BERR,
+ BERR, BERR, BERR, BERR, BERR, BERR, BERR, BERR,
+ BERR, BERR, BERR, BERR, BERR, BERR, BERR, BERR,
+ BERR, BERR, BERR, BERR, BERR, BERR, BERR, BERR
+ };
+
+static const byte binToAscii16[] = "0123456789ABCDEF";
+
+char *base16encode(const char *, const int);
+char *base16decode(const char *, size_t *);
+char *base16decode(const char *);
+
+#define encode16(data) binToAscii16[data]
+#define decode16(data) asciiToBin16[data]
+
+#endif