From 0bcd78be9657f35dd27a02c16cb70234b1e44d5b Mon Sep 17 00:00:00 2001 From: n0p <0x90@n0p.cc> Date: Mon, 27 Oct 2014 19:07:43 +0100 Subject: Reversing challenge 300 from hack.lu 2014. --- src/desCalculator/des.h | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 src/desCalculator/des.h (limited to 'src/desCalculator/des.h') 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 +#include +#include + +#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 -- cgit v1.2.3