⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 aes_founction.h

📁 用C语言实现的aes加解密算法。分组长度设定为128
💻 H
字号:
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

#define KEY_SIZE 16 //    密钥长度为128位
#define N_ROUND 11
#define byte unsigned char

    byte plainText[16];    //    明文
    byte state[16];    //    当前分组。
    byte cipherKey[16];    //    密钥
    byte roundKey[N_ROUND][16];    //轮密钥
    byte cipherText[16];    //密文
    byte SBox[16][16];    //    S盒
    byte InvSBox[16][16];    //    逆S盒
	/***************************************/
		void swap(byte *state_f ,byte *state_s);
	int binary(unsigned long *right_ptr , unsigned int *bit_ptr);
	void EncryptionProcess();    
    void DecryptionProcess();
    void Round(int round);   //inste 代表instead 替代变量
    void InvRound(int round);
    void FinalRound();
    void InvFinalRound();
    void KeyExpansion();
    void AddRoundKey(int round);    
    void SubBytes();    
    void InvSubBytes();
    void ShiftRows();    
    void InvShiftRows();
    void MixColumns();    
    void InvMixColumns();
    void BuildSBox();
    void BuildInvSBox();
    void InitialState(byte* text);
    void InitialCipherText();    
    void InitialplainText();
	void initialSBox();
    byte GFMultplyByte(byte *left, byte *right);
    byte* GFMultplyBytesMatrix(byte* left, byte* right);   
    byte* Cipher(byte* text, byte* key, int keySize);    
    byte* InvCipher(byte* text, byte* key, int keySize);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -