?? helix.h
字號:
/*
Module : Helix.H
Purpose: C++ class to encapsulate the Helix Encryption and Authentication algorithm as presented in
a November 2003 Dr. Dobb's Journal article by Niels Ferguson and Bruce Schneier. For
further information please refer to the article and / or the web site for it at
http://www.macfergus.com/helix
Created: PJN / 29-11-2003
Copyright (c) 2003 - 2004 by PJ Naughter. (Web: www.naughter.com, Email: pjna@naughter.com)
All rights reserved.
Copyright / Usage Details:
You are allowed to include the source code in any product (commercial, shareware, freeware or otherwise)
when your product is released in binary form. You are allowed to modify the source code in any way you want
except you cannot modify the copyright details at the top of each module. If you want to distribute source
code with your application, then you are only allowed to distribute versions released by the author. This is
to maintain a single distribution point for the source code.
*/
#ifndef __HELIX_H__
#define __HELIX_H__
//Class which encapsulates a "nonce" as used by the Helix algorithm
class CHelixNonce
{
public:
//Constructors / Destructors
CHelixNonce();
//Member variables
BYTE m_Data[16];
};
//Class which encapsulates a "Message Authentication Code" as used by the Helix algorithm
class CHelixMAC
{
public:
//Constructors / Destructors
CHelixMAC();
//Methods
friend operator==(const CHelixMAC& mac1, const CHelixMAC& mac2);
//Member variables
BYTE m_Data[16];
};
//Class which encapsulates the actual Helix encryption / decryption algorithm
class CHelix
{
public:
//Constructors / Destructors
CHelix();
//Methods
BOOL SetKey(const BYTE* pbyKey, DWORD dwKeyLength);
BOOL Encrypt(const BYTE* pbyPlainText, DWORD dwPlainTextSize, const CHelixNonce& nonce, BYTE* pbyCipherText, CHelixMAC& mac);
BOOL Decrypt(const BYTE* pbyCipherText, DWORD dwCipherTextSize, const CHelixNonce& nonce, const CHelixMAC& mac, BYTE* pbyPlainText);
protected:
//Methods
inline void Block(DWORD X0, DWORD P, DWORD X1);
void Start(const CHelixNonce& nonce);
void Finish(DWORD lnm4, CHelixMAC& Mac);
//Member variables
DWORD m_Z[5];
DWORD m_K[8];
DWORD m_X1[8];
int m_dwKLen;
int m_i8;
};
#endif //__HELIX_H__
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -