summaryrefslogtreecommitdiff
path: root/modules/encryption/encryption.h
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2012-11-30 02:49:09 -0500
committerAdam <Adam@anope.org>2012-11-30 02:53:03 -0500
commita4468dd56e96ea915d40627f3cb067084238e34a (patch)
treea8a497965346e55eeb79fc56797da6bea81bf841 /modules/encryption/encryption.h
parent337f3615264f30d4c9f06653d2dd2a21805546ce (diff)
Allow modules to use the encryption modules to encrypt arbitrary things.
Made enc_old depend on enc_md5. Allow not loading any encryption modules if you want to only use an external mechanism. Removed ns_sendpass since it's just a bad idea.
Diffstat (limited to 'modules/encryption/encryption.h')
-rw-r--r--modules/encryption/encryption.h37
1 files changed, 37 insertions, 0 deletions
diff --git a/modules/encryption/encryption.h b/modules/encryption/encryption.h
new file mode 100644
index 000000000..95e5a7299
--- /dev/null
+++ b/modules/encryption/encryption.h
@@ -0,0 +1,37 @@
+/*
+ *
+ * (C) 2003-2012 Anope Team
+ * Contact us at team@anope.org
+ *
+ * Please read COPYING and README for further details.
+ *
+ * Based on the original code of Epona by Lara.
+ * Based on the original code of Services by Andy Church.
+ *
+ */
+
+namespace Encryption
+{
+ typedef std::pair<const unsigned char *, size_t> Hash;
+ typedef std::pair<const uint32_t *, size_t> IV;
+
+ class Context
+ {
+ public:
+ virtual ~Context() { }
+ virtual void Update(const unsigned char *data, size_t len) = 0;
+ virtual void Finalize() = 0;
+ virtual Hash GetFinalizedHash() = 0;
+ };
+
+ class Provider : public Service
+ {
+ public:
+ Provider(Module *creator, const Anope::string &sname) : Service(creator, "Encryption::Provider", sname) { }
+ virtual ~Provider() { }
+
+ virtual Context *CreateContext(IV * = NULL) = 0;
+ virtual IV GetDefaultIV() = 0;
+ };
+}
+