資源簡介
作為一種比較新的加密算法, PRESENT具有許多優異的特性。對它的研究能夠很好的啟發學生對密碼學的認識。

代碼片段和文件信息
//?Present.cpp?:?Defines?the?entry?point?for?the?console?application.
//
/*
?*?Copyright?(c)?2010?Department?of?Computer?Engineering?Ordnance?Engineering?College
?*?All?rights?reserved.
?*
?*?Redistribution?and?use?in?source?and?binary?forms?with?or?without
?*?modification?are?permitted?provided?that?the?following?conditions
?*?are?met:
?*?-?Redistributions?of?source?code?must?retain?the?above?copyright
?*???notice?this?list?of?conditions?and?the?following?disclaimer.
?*?-?Redistributions?in?binary?form?must?reproduce?the?above?copyright
?*???notice?this?list?of?conditions?and?the?following?disclaimer?in
?*???the?documentation?and/or?other?materials?provided?with?the
?*???distribution.
?*?-?Neither?the?name?of?the?Department?of?Computer?Engineering?
?*?Ordnance?Engineering?College?nor?the??names?of?its?contributors
?*?may?be?used?to?endorse?or?promote?products?derived?from?this?software
?*??without?specific?prior?written?permission.
?*
?*?THIS?SOFTWARE?IS?PROVIDED?BY?THE?COPYRIGHT?HOLDERS?AND?CONTRIBUTORS
?*?“AS?IS“?AND?ANY?EXPRESS?OR?IMPLIED?WARRANTIES?INCLUDING?BUT?NOT
?*?LIMITED?TO?THE?IMPLIED?WARRANTIES?OF?MERCHANTABILITY?AND?FITNESS
?*?FOR?A?PARTICULAR?PURPOSE?ARE?DISCLAIMED.?IN?NO?EVENT?SHALL?THE
?*?COPYRIGHT?OWNER?OR?CONTRIBUTORS?BE?LIABLE?FOR?ANY?DIRECT?INDIRECT
?*?INCIDENTAL?SPECIAL?EXEMPLARY?OR?CONSEQUENTIAL?DAMAGES?(INCLUDING
?*?BUT?NOT?LIMITED?TO?PROCUREMENT?OF?SUBSTITUTE?GOODS?OR?SERVICES;
?*?LOSS?OF?USE?DATA?OR?PROFITS;?OR?BUSINESS?INTERRUPTION)?HOWEVER
?*?CAUSED?AND?ON?ANY?THEORY?OF?LIABILITY?WHETHER?IN?CONTRACT?STRICT
?*?LIABILITY?OR?TORT?(INCLUDING?NEGLIGENCE?OR?OTHERWISE)?ARISING?IN
?*?ANY?WAY?OUT?OF?THE?USE?OF?THIS?SOFTWARE?EVEN?IF?ADVISED?OF?THE
?*?POSSIBILITY?OF?SUCH?DAMAGE.
?*/
/*
?*?The?core?function?of?PRESENT?block?cipher.
?*
?*?@author?Xinjie?ZHAO
?*?@Email?zhaoxinjieem@163.com?
?*?@date???May?20?2010
?*/
#include?“stdafx.h“
#include?“stdlib.h“
#include?
#include?
typedef?unsigned?char?Byte;
static?const?Byte?Sbox[16]?=?{
0x0c?0x05?0x06?0x0b?
0x09?0x00?0x0a?0x0d?
0x03?0x0e?0x0f?0x08?
0x04?0x07?0x01?0x02
};
static?const?Byte?DSbox[16]?=?{
0x050x0e?0x0f?0x08?
0x0c0x01?0x02?0x0d?
0x0b0x04?0x06?0x03
0x000x07?0x09?0x0a??
};
static??Byte?Px[64]={
0163248117334921834503193551
4203652521375362238547233955
????824405692541571026425811274359
12284460132945611430466215314763
};
static??Byte?rPx[64]={
04812162024283236404448525660
15913172125293337414549535761
261014182226303438424650545862
371115192327313539434751555963
};
static??Byte?testPx[8]={
76543210
};
void?printblock(const?Byte?*bint?nlenth)
{
???for(int?i=0;i printf(“%2x??“?b[i]);
}
//S盒
void?Sub_bytes(Byte?*s)
{
Byte?t[16];
int?i;
memset(t016);
??
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件????????6249??2011-05-02?22:01??PRESENT(2007年提出).cpp
評論
共有 條評論