~ubuntu-branches/ubuntu/karmic/libcrypto++/karmic

« back to all changes in this revision

Viewing changes to skipjack.h

  • Committer: Bazaar Package Importer
  • Author(s): Stephen Zander
  • Date: 2004-04-19 18:10:28 UTC
  • Revision ID: james.westby@ubuntu.com-20040419181028-a9dyhq48t3slmcwt
Tags: upstream-5.1
ImportĀ upstreamĀ versionĀ 5.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef CRYPTOPP_SKIPJACK_H
 
2
#define CRYPTOPP_SKIPJACK_H
 
3
 
 
4
/** \file
 
5
*/
 
6
 
 
7
#include "seckey.h"
 
8
#include "secblock.h"
 
9
 
 
10
NAMESPACE_BEGIN(CryptoPP)
 
11
 
 
12
struct SKIPJACK_Info : public FixedBlockSize<8>, public FixedKeyLength<10>
 
13
{
 
14
        static const char *StaticAlgorithmName() {return "SKIPJACK";}
 
15
};
 
16
 
 
17
/// <a href="http://www.weidai.com/scan-mirror/cs.html#SKIPJACK">SKIPJACK</a>
 
18
class SKIPJACK : public SKIPJACK_Info, public BlockCipherDocumentation
 
19
{
 
20
        class Base : public BlockCipherBaseTemplate<SKIPJACK_Info>
 
21
        {
 
22
        public:
 
23
                void UncheckedSetKey(CipherDir direction, const byte *userKey, unsigned int length);
 
24
 
 
25
        protected:
 
26
                static const byte fTable[256];
 
27
 
 
28
                FixedSizeSecBlock<byte[256], 10> tab;
 
29
        };
 
30
 
 
31
        class Enc : public Base
 
32
        {
 
33
        public:
 
34
                void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const;
 
35
        private:
 
36
                static const byte Se[256];
 
37
                static const word32 Te[4][256];
 
38
        };
 
39
 
 
40
        class Dec : public Base
 
41
        {
 
42
        public:
 
43
                void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const;
 
44
        private:
 
45
                static const byte Sd[256];
 
46
                static const word32 Td[4][256];
 
47
        };
 
48
 
 
49
public:
 
50
        typedef BlockCipherTemplate<ENCRYPTION, Enc> Encryption;
 
51
        typedef BlockCipherTemplate<DECRYPTION, Dec> Decryption;
 
52
};
 
53
 
 
54
typedef SKIPJACK::Encryption SKIPJACKEncryption;
 
55
typedef SKIPJACK::Decryption SKIPJACKDecryption;
 
56
 
 
57
NAMESPACE_END
 
58
 
 
59
#endif