AES128-ECB对文件进行加密解密验证
一、源码函数讲解
#ifndef __AES_H__
#define __AES_H__
#include <stdint.h>
/* generate expanded key */
参数:key 128bit的密钥
ekey 扩展后的密钥(11*16byte)
void AES_KeySchedule(uint8_t *key, uint8_t *ekey); //扩展密钥
/* perform encryption */
参数:ekey 扩展后的密钥(11*16byte)
state 要加密的128bit数据,加密后的数据也存放在这里
void AES_Encrypt(uint8_t *ekey, uint8_t *state); //加密
/* perform decryption */
参数:ekey 扩展后的密钥(11*16byte)
state 要解密的128bit数据,解密后的数据也存放在这里
void AES_Decrypt(uint8_t *ekey, uint8_t *state); //解密
#endif
二、demo验证
#include "stdio.h"