aboutsummaryrefslogtreecommitdiffstats
path: root/Plugins/DbSqliteWx/fastpbkdf2.h
diff options
context:
space:
mode:
authorLibravatarUnit 193 <unit193@ubuntu.com>2018-07-27 23:54:15 -0400
committerLibravatarUnit 193 <unit193@ubuntu.com>2018-07-27 23:54:15 -0400
commit6d3d39356473078c6b47e03b8a7616e4b34de928 (patch)
treefe5be2e6a08e4cfc73207746aba4c9fccfecfa10 /Plugins/DbSqliteWx/fastpbkdf2.h
parentf98e49169a40876bcf1df832de6e908d1b350193 (diff)
parentfeda8a7db8d1d7c5439aa8f8feef7cc0dd2b59a0 (diff)
Update upstream source from tag 'upstream/3.2.1+dfsg1'
Update to upstream version '3.2.1+dfsg1' with Debian dir 5ea0333565de4dc898c062cc0ff4ba1153e2c1e4
Diffstat (limited to 'Plugins/DbSqliteWx/fastpbkdf2.h')
-rw-r--r--Plugins/DbSqliteWx/fastpbkdf2.h72
1 files changed, 72 insertions, 0 deletions
diff --git a/Plugins/DbSqliteWx/fastpbkdf2.h b/Plugins/DbSqliteWx/fastpbkdf2.h
new file mode 100644
index 0000000..67d4184
--- /dev/null
+++ b/Plugins/DbSqliteWx/fastpbkdf2.h
@@ -0,0 +1,72 @@
+/*
+ * fastpbkdf2 - Faster PBKDF2-HMAC calculation
+ * Written in 2015 by Joseph Birr-Pixton <jpixton@gmail.com>
+ *
+ * To the extent possible under law, the author(s) have dedicated all
+ * copyright and related and neighboring rights to this software to the
+ * public domain worldwide. This software is distributed without any
+ * warranty.
+ *
+ * You should have received a copy of the CC0 Public Domain Dedication
+ * along with this software. If not, see
+ * <http://creativecommons.org/publicdomain/zero/1.0/>.
+ */
+
+#ifndef FASTPBKDF2_H
+#define FASTPBKDF2_H
+
+#include <stdlib.h>
+#include <stdint.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** Calculates PBKDF2-HMAC-SHA1.
+ *
+ * @p npw bytes at @p pw are the password input.
+ * @p nsalt bytes at @p salt are the salt input.
+ * @p iterations is the PBKDF2 iteration count and must be non-zero.
+ * @p nout bytes of output are written to @p out. @p nout must be non-zero.
+ *
+ * This function cannot fail; it does not report errors.
+ */
+void fastpbkdf2_hmac_sha1(const uint8_t *pw, size_t npw,
+ const uint8_t *salt, size_t nsalt,
+ uint32_t iterations,
+ uint8_t *out, size_t nout);
+
+/** Calculates PBKDF2-HMAC-SHA256.
+ *
+ * @p npw bytes at @p pw are the password input.
+ * @p nsalt bytes at @p salt are the salt input.
+ * @p iterations is the PBKDF2 iteration count and must be non-zero.
+ * @p nout bytes of output are written to @p out. @p nout must be non-zero.
+ *
+ * This function cannot fail; it does not report errors.
+ */
+void fastpbkdf2_hmac_sha256(const uint8_t *pw, size_t npw,
+ const uint8_t *salt, size_t nsalt,
+ uint32_t iterations,
+ uint8_t *out, size_t nout);
+
+/** Calculates PBKDF2-HMAC-SHA512.
+ *
+ * @p npw bytes at @p pw are the password input.
+ * @p nsalt bytes at @p salt are the salt input.
+ * @p iterations is the PBKDF2 iteration count and must be non-zero.
+ * @p nout bytes of output are written to @p out. @p nout must be non-zero.
+ *
+ * This function cannot fail; it does not report errors.
+ */
+void fastpbkdf2_hmac_sha512(const uint8_t *pw, size_t npw,
+ const uint8_t *salt, size_t nsalt,
+ uint32_t iterations,
+ uint8_t *out, size_t nout);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+