summaryrefslogtreecommitdiffabout
path: root/pwmanager/pwmanager/blowfish.h
Side-by-side diff
Diffstat (limited to 'pwmanager/pwmanager/blowfish.h') (more/less context) (ignore whitespace changes)
-rw-r--r--pwmanager/pwmanager/blowfish.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/pwmanager/pwmanager/blowfish.h b/pwmanager/pwmanager/blowfish.h
index 5129eab..862cccb 100644
--- a/pwmanager/pwmanager/blowfish.h
+++ b/pwmanager/pwmanager/blowfish.h
@@ -1,78 +1,80 @@
/***************************************************************************
* *
* copyright (C) 2003, 2004 by Michael Buesch *
* email: mbuesch@freenet.de *
* *
* blowfish.c - Blowfish encryption *
* Copyright (C) 1998, 2001, 2002 Free Software Foundation, Inc. *
* *
* 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 BLOWFISH_H
#define BLOWFISH_H
-#include "pwmexception.h"
+//#include "pwmexception.h"
#ifndef _WIN32_
#include <stdint.h>
#else
#endif
#include <string>
using std::string;
#define BLOWFISH_BLOCKSIZE 8
#define BLOWFISH_ROUNDS 16
#define CIPHER_ALGO_BLOWFISH 4 /* blowfish 128 bit key */
#ifndef _WIN32_
typedef uint8_t byte;
#else
#define uint8_t Q_UINT8
#define byte Q_UINT8
#define uint32_t Q_UINT32
#endif
+//#include "pwmexception.h"
+
/** blowfish encryption algorithm.
* Derived from libgcrypt-1.1.12
*/
class Blowfish
{
struct BLOWFISH_context
{
uint32_t s0[256];
uint32_t s1[256];
uint32_t s2[256];
uint32_t s3[256];
uint32_t p[BLOWFISH_ROUNDS+2];
};
public:
Blowfish() {}
static bool selfTest();
/** set key to encrypt. if return == 1, it is a weak key. */
int bf_setkey( byte *key, unsigned int keylen );
/** encrypt inbuf and return it in outbuf.
* inbuf and outbuf have to be: buf % 8 == 0
* You may check this with getPaddedLen() and pad with NULL.
*/
int bf_encrypt( byte *outbuf, byte *inbuf, unsigned int inbuf_len );
/** decrypt inbuf and return it in outbuf.
* inbuf and outbuf have to be: buf % 8 == 0
* You may check this with getPaddedLen() and pad with NULL.
*/
int bf_decrypt( byte *outbuf, byte *inbuf, unsigned int inbuf_len );
/** returns the length, the sting has to be padded to */
static unsigned int getPaddedLen(unsigned int inLen)