资源简介
AES/ECB/PKCS5Padding C++实现
代码片段和文件信息
//
// AES_.c
// Encryption
//
// Created by Jason.xu on 13-10-22.
// Copyright (c) 2013年 zhoumin. All rights reserved.
//
/*
* FIPS-197 compliant AES implementation
*
* Copyright (C) 2003-2006 Christophe Devine
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1 as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not write to the Free Software
* Foundation Inc. 51 Franklin Street Fifth Floor Boston
* MA 02110-1301 USA
*/
/*
* The AES block cipher was designed by Vincent Rijmen and Joan Daemen.
*
* http://csrc.nist.gov/encryption/aes/rijndael/Rijndael.pdf
* http://csrc.nist.gov/publications/fips/fips197/fips-197.pdf
*/
#ifndef _CRT_SECURE_NO_DEPRECATE
#define _CRT_SECURE_NO_DEPRECATE 1
#endif
#include
#include
#include
#include “AES.h“
#ifndef uint8
#define uint8 unsigned char
#endif
#ifndef uint32
#define uint32 unsigned long
#endif
/*
* 32-bit integer manipulation macros (big endian)
*/
#ifndef GET_UINT32_BE
#define GET_UINT32_BE(nbi) \
{ \
(n) = ( (uint32) (b)[(i) ] << 24 ) \
| ( (uint32) (b)[(i) + 1] << 16 ) \
| ( (uint32) (b)[(i) + 2] << 8 ) \
| ( (uint32) (b)[(i) + 3] ); \
}
#endif
#ifndef PUT_UINT32_BE
#define PUT_UINT32_BE(nbi) \
{ \
(b)[(i) ] = (uint8) ( (n) >> 24 ); \
(b)[(i) + 1] = (uint8) ( (n) >> 16 ); \
(b)[(i) + 2] = (uint8) ( (n) >> 8 ); \
(b)[(i) + 3] = (uint8) ( (n) ); \
}
#endif
/*
* Uncomment the following line to use pre-computed tables
* otherwise the tables will be generated at the first run.
*
* #define FIXED_TABLES
*/
#if !defined(FIXED_TABLES)
/*
* Forward S-box & tables
*/
static uint8 FSb[256];
static uint32 FT0[256];
static uint32 FT1[256];
static uint32 FT2[256];
static uint32 FT3[256];
/*
* Reverse S-box & tables
*/
static uint8 RSb[256];
static uint32 RT0[256];
static uint32 RT1[256];
static uint32 RT2[256];
static uint32 RT3[256];
/*
* Round constants
*/
static uint32 RCON[10];
/*
* Tables generation code
*/
#define ROTR8(x) ( ( ( x << 24 ) & 0xFFFFFFFF ) | \
( ( x & 0xFFFFFFFF ) >> 8 ) )
#define XTIME(x) ( ( x << 1 ) ^ ( ( x & 0x80 ) ? 0x1B : 0x00 ) )
#define MUL(xy) ( ( x && y ) ? pow[(log[x] + log[y]) % 255] : 0 )
s
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 38907 2017-08-22 16:35 AES.cpp
文件 3166 2017-08-22 16:35 AES.h
- 上一篇:c语言课程设计图书信息管理系统
- 下一篇:多峰函数多个最优解问题 演化算法
相关资源
- C语言环境下的AES加密算法,支持128位
- AES快速实现,加密速度大约1.4G/s,不
- AES多种加密解密方式C语言方式实现
- aes密钥扩展C语言实现
- C语言 3DES、AES、RC6、TEA、RSA、MD5、S
- C语言实现的AES加密解密
- AES、DES加密算法C语言源码
- AES 加解密c++
- AES s盒生成代码
- AES加密解密系统 VC++6.0 实现
- AES密码算法C语言实现
- C语言 stm32 AES加密解密
- AES单片机加密解密 C语言源代码
- aes算法实现C++)
- AES任意文件长度加解密C语言实现
- aes加密算法matlab
- AES128 C语言实现源码及应用例程
- CMAC(AES128)Verilog实现
- aes加密算法的verilog和c++代码
- AES加密源码使用C++实现
- AES算法源码~~~~~~~~~~~~
- zw_AES加密算法c语言实现代码.zip
- AES加密MFC程序源码
- C语言实现AES加密、解密算法
- AES加解密算法的源程序C语言版
- AES-128加密算法,C语言实现
- AES(ECB、CBC、CFB、CTR)128/192/256加密算
- C++ 使用AES算法对文本文件进行加密
- C++ AES算法ECB模式包含128192256三种密钥
- AES加密MFC实现
评论
共有 条评论