aboutsummaryrefslogtreecommitdiff
path: root/src/desCalculator/des.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/desCalculator/des.h')
-rw-r--r--src/desCalculator/des.h25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/desCalculator/des.h b/src/desCalculator/des.h
new file mode 100644
index 0000000..a861f2a
--- /dev/null
+++ b/src/desCalculator/des.h
@@ -0,0 +1,25 @@
+#include <stdint.h>
+#include <string.h>
+#include <stdio.h>
+
+#ifndef DES_H
+#define DES_H
+
+#define rotl32(x,n) (((x) << ((uint32_t)(n))) | ((x) >> (32 - (uint32_t)(n))))
+#define rotr32(x,n) (((x) >> ((uint32_t)(n))) | ((x) << (32 - (uint32_t)(n))))
+
+#define byteswap32(x) ((rotl32(x, 8) & 0x00ff00ff) | (rotr32(x, 8) & 0xff00ff00))
+
+#define Bzero(x, y) memset(x, 0, y)
+
+typedef struct des_key {
+ char kn[16][8];
+ uint32_t sp[8][64];
+ char iperm[16][16][8];
+ char fperm[16][16][8];
+} DES_KEY;
+
+int _mcrypt_set_key(DES_KEY * dkey, char *user_key, int len);
+void _mcrypt_encrypt(DES_KEY * key, char *block);
+
+#endif \ No newline at end of file