KWallet

blowfish.h
1/*
2 This file is part of the KDE project
3 SPDX-FileCopyrightText: 2001 George Staikos <staikos@kde.org>
4
5 SPDX-License-Identifier: LGPL-2.0-or-later
6*/
7
8#ifndef _BLOWFISH_H
9#define _BLOWFISH_H
10
11#include <config-kwalletbackend.h>
12
13#if HAVE_STDINT_H
14#include <stdint.h>
15#endif
16#include <sys/types.h>
17#if HAVE_SYS_BITYPES_H
18#include <sys/bitypes.h> /* For uintXX_t on Tru64 */
19#endif
20
21#include "blockcipher.h"
22#include "kwalletbackend_export.h"
23
24/* @internal
25 */
26class KWALLETBACKEND_EXPORT BlowFish : public BlockCipher
27{
28public:
29 BlowFish();
30 ~BlowFish() override;
31
32 bool setKey(void *key, int bitlength) override;
33
34 int keyLen() const override;
35
36 bool variableKeyLen() const override;
37
38 bool readyToGo() const override;
39
40 int encrypt(void *block, int len) override;
41
42 int decrypt(void *block, int len) override;
43
44private:
45 uint32_t m_S[4][256];
46 uint32_t m_P[18];
47
48 void *m_key;
49 int m_keylen; // in bits
50
51 bool m_initialized;
52
53 bool init();
54 uint32_t F(uint32_t x);
55 void encipher(uint32_t *xl, uint32_t *xr);
56 void decipher(uint32_t *xl, uint32_t *xr);
57};
58
59#endif
QCA_EXPORT void init()
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 17:01:06 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.