summaryrefslogtreecommitdiffabout
path: root/pwmanager/pwmanager/base64.h
authorulf69 <ulf69>2004-09-15 17:53:22 (UTC)
committer ulf69 <ulf69>2004-09-15 17:53:22 (UTC)
commitd3925ba5bd25224bc4a60d3d6a107c464994a1ea (patch) (side-by-side diff)
tree60f69da1d2b79ee3081e7ef5c09a46470ca6eda0 /pwmanager/pwmanager/base64.h
parentce83a3479d23b9e8a59c745ccd0a0b14f64ef4e8 (diff)
downloadkdepimpi-d3925ba5bd25224bc4a60d3d6a107c464994a1ea.zip
kdepimpi-d3925ba5bd25224bc4a60d3d6a107c464994a1ea.tar.gz
kdepimpi-d3925ba5bd25224bc4a60d3d6a107c464994a1ea.tar.bz2
initial revision
Diffstat (limited to 'pwmanager/pwmanager/base64.h') (more/less context) (ignore whitespace changes)
-rw-r--r--pwmanager/pwmanager/base64.h97
1 files changed, 97 insertions, 0 deletions
diff --git a/pwmanager/pwmanager/base64.h b/pwmanager/pwmanager/base64.h
new file mode 100644
index 0000000..f497b9e
--- a/dev/null
+++ b/pwmanager/pwmanager/base64.h
@@ -0,0 +1,97 @@
+/*******************************************************************
+ * base64.h
+ * © Copyright 1995 John Halleck
+ * All Rights Reserved
+ *
+ * ported to c++ by Michael Buesch <mbuesch@freenet.de>
+ *
+ * --ABSTRACT-- base64.h
+ * Do the base 64 encoding as used by PEM and MIME.
+ *
+ * --KEYWORDS-- base64.h
+ *
+ * --CONTENTS-- base64.h
+ * Date, Department, Author
+ * 23nov1994, John Halleck
+ * Revision history
+ * For each revision: Date, change summary, authorizing document,
+ * change department, section, author
+ * 23nov1994, Initial Creation, John Halleck
+ * 8apr1995, split library into hex and base64 libraries, John Halleck
+ * Unit purpose
+ * (What does this do?)
+ * [Nothing]
+ * External Units accessed
+ * Name, purpose, access summary
+ * [None]
+ * Exceptions propagated by this unit
+ * [None]
+ * Machine-dependencies
+ * Access type, purpose, and justification
+ * [None]
+ * Compiler-dependencies
+ * [None]
+ *********************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License version 2 *
+ * as published by the Free Software Foundation. *
+ * *
+ ***************************************************************************/
+
+/***************************************************************************
+ * copyright (C) 2004 by Ulf Schenk
+ * This file is originaly based on version 1.0.1 of pwmanager
+ * and was modified to run on embedded devices that run microkde
+ *
+ * $Id$
+ **************************************************************************/
+
+
+#ifndef __BASE64_H
+#define __BASE64_H
+
+#include <string>
+
+using std::string;
+
+class Base64
+{
+protected:
+ struct Base64Ctx
+ {
+ int temp; // Working value for input
+ int bytes; // which input byte we are working on
+ string buf; // Data buffer
+ };
+
+public:
+ Base64() {}
+ /** run algorithm self test */
+ static bool selfTest();
+
+ /** encode "data" */
+ string encode(const string &data);
+ /** decode "data" */
+ string decode(const string &data);
+
+protected:
+ /** initialize the context */
+ void initCtx();
+ /** finalize the context */
+ void encFinalizeCtx();
+ /** finalize the context */
+ void decFinalizeCtx();
+ /** encode a character */
+ void encodeChar(unsigned char c);
+ /** decode a character */
+ void decodeChar(char c);
+
+protected:
+ /** Base64 context */
+ Base64Ctx ctx;
+};
+
+#endif // __BASE64_H