~ubuntu-branches/debian/jessie/armory/jessie

« back to all changes in this revision

Viewing changes to cppForSwig/cryptopp/blowfish.h

  • Committer: Package Import Robot
  • Author(s): Joseph Bisch
  • Date: 2014-10-07 10:22:45 UTC
  • Revision ID: package-import@ubuntu.com-20141007102245-2s3x3rhjxg689hek
Tags: upstream-0.92.3
ImportĀ upstreamĀ versionĀ 0.92.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef CRYPTOPP_BLOWFISH_H
 
2
#define CRYPTOPP_BLOWFISH_H
 
3
 
 
4
/** \file */
 
5
 
 
6
#include "seckey.h"
 
7
#include "secblock.h"
 
8
 
 
9
NAMESPACE_BEGIN(CryptoPP)
 
10
 
 
11
//! _
 
12
struct Blowfish_Info : public FixedBlockSize<8>, public VariableKeyLength<16, 1, 56>, public FixedRounds<16>
 
13
{
 
14
        static const char *StaticAlgorithmName() {return "Blowfish";}
 
15
};
 
16
 
 
17
//! <a href="http://www.weidai.com/scan-mirror/cs.html#Blowfish">Blowfish</a>
 
18
class Blowfish : public Blowfish_Info, public BlockCipherDocumentation
 
19
{
 
20
        class CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl<Blowfish_Info>
 
21
        {
 
22
        public:
 
23
                void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const;
 
24
                void UncheckedSetKey(const byte *key_string, unsigned int keylength, const NameValuePairs &params);
 
25
 
 
26
        private:
 
27
                void crypt_block(const word32 in[2], word32 out[2]) const;
 
28
 
 
29
                static const word32 p_init[ROUNDS+2];
 
30
                static const word32 s_init[4*256];
 
31
 
 
32
                FixedSizeSecBlock<word32, ROUNDS+2> pbox;
 
33
                FixedSizeSecBlock<word32, 4*256> sbox;
 
34
        };
 
35
 
 
36
public:
 
37
        typedef BlockCipherFinal<ENCRYPTION, Base> Encryption;
 
38
        typedef BlockCipherFinal<DECRYPTION, Base> Decryption;
 
39
};
 
40
 
 
41
typedef Blowfish::Encryption BlowfishEncryption;
 
42
typedef Blowfish::Decryption BlowfishDecryption;
 
43
 
 
44
NAMESPACE_END
 
45
 
 
46
#endif