資源簡(jiǎn)介
AES加密解密C語(yǔ)言源代碼 Keil C51 51單片機(jī)STM32可用,可用128-Bit 192-Bit 256-Bit 加密解密;用于數(shù)據(jù)傳輸,提高安全性

代碼片段和文件信息
//-----------------------------------------------------------------------------
//?F326_AES_Cipher.c
//-----------------------------------------------------------------------------
//?Copyright?2007?Silicon?Laboratories?Inc.
//?http://www.silabs.com
//
//?Program?Description:
//
//
//?How?To?Test:????See?Readme.txt
//
//?????????
//?Target:?????????C8051F326
//?Tool?chain:?????Keil?C51?7.50?/?Keil?EVAL?C51
//?????????????????Silicon?Laboratories?IDE?version?2.91
//?Command?Line:???See?Readme.txt
//?Project?Name:???F326_AES
//
//
//?Release?1.0
//????-Initial?Revision?(CG/GP)
//????-11?JUN?2007
//
//-----------------------------------------------------------------------------
//?Includes
//-----------------------------------------------------------------------------
#include?“F326_AES_Typedef.h“
#include?“F326_AES_Parameters.h“
#include?“F326_AES_Sbox.h“
#include?“F326_AES_Cipher.h“
//-----------------------------------------------------------------------------
//?Global?Constants
//-----------------------------------------------------------------------------
extern?pdata?byte?EXP_KEYS[];
static?byte?data?State[4][4];??????????//?State?vector;?stored?explicitly?in
???????????????????????????????????????//?RAM?for?speed?purposes
static?byte?data?CurrentKey[4][4];?????//?Stores?the?keys?for?the?current?round
???????????????????????????????????????//?of?encryption
//-----------------------------------------------------------------------------
//?Prototypes
//-----------------------------------------------------------------------------
void?Cipher?(byte?*in?byte?*out);
//?Functions?defined?in?the?AES?specification;?Core?functions?of?the?encryption
void?SubBytes????(void);
void?ShiftRows???(void);
void?MixColumns??(void);
void?AddRoundKey?(void);
void?StateIn?????(byte?*in);
void?StateOut????(byte?*out);
void?LoadKeys????(char?i);
byte?xtime???????(byte?input);
static?byte?FFMultiply?(byte?x?byte?y);
//-----------------------------------------------------------------------------
//?Support?Subroutines
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
//?Cipher
//-----------------------------------------------------------------------------
//
//?Return?Value?:?None
//?Parameters???:?1)?byte?*in?-?pointer?to?array?of?input?plaintext?data
//????????????????2)?byte?*out?-?pointer?to?array?output?encrypted?data
//
//?Procedure?that?encrypts?a?message?using?AES/Rijndael?
//
//-----------------------------------------------------------------------------
void?Cipher?(byte?*in?byte?*out)
{
???char?r;
???StateIn?(in);???????????????????????//?Load?string?to?be?encrypted
???LoadKeys?(0);
???AddRoundKey?();?????????????????????//?Initial?key?addition?(round?key)
???for(r?=?1;?r????{
??????SubBytes?();??????
?屬性????????????大小?????日期????時(shí)間???名稱(chēng)
-----------?---------??----------?-----??----
?????目錄???????????0??2007-06-13?13:10??AN324SW\
?????文件???????35077??2007-06-13?13:10??AN324SW\F326_AES.wsp
?????文件???????12425??2007-06-13?13:10??AN324SW\F326_AES_Cipher.c
?????文件????????1494??2007-06-13?13:10??AN324SW\F326_AES_Cipher.h
?????文件???????14055??2007-06-13?13:10??AN324SW\F326_AES_InvCipher.c
?????文件????????7231??2007-06-13?13:10??AN324SW\F326_AES_InvCipher.h
?????文件????????3973??2007-06-13?13:10??AN324SW\F326_AES_KeyExpander.c
?????文件????????3108??2007-06-13?13:10??AN324SW\F326_AES_KeyExpander.h
?????文件????????5999??2007-06-13?13:10??AN324SW\F326_AES_Main.c
?????文件????????2925??2007-06-13?13:10??AN324SW\F326_AES_Parameters.h
?????文件????????2924??2007-06-13?13:10??AN324SW\F326_AES_Sbox.h
?????文件????????1489??2007-06-13?13:10??AN324SW\F326_AES_Typedef.h
?????文件????????1775??2007-06-13?13:10??AN324SW\Readme.txt
?????文件?????????712??2007-06-13?13:10??AN324SW\ReleaseNotes.txt
評(píng)論
共有 條評(píng)論