资源简介
包含 aes128/192/256 ecb cbc cfb ofb ctr纯c代码,vs2015工程,快速了解各种模式的加解密调用。参考资源:https://download.csdn.net/download/howiexue/9978483,改编简单明了加解密例子,并且关键地方加了注释。
代码片段和文件信息
/*
---------------------------------------------------------------------------
Copyright (c) 1998-2013 Brian Gladman Worcester UK. All rights reserved.
The redistribution and use of this software (with or without changes)
is allowed without the payment of fees or royalties provided that:
source code distributions include the above copyright notice this
list of conditions and the following disclaimer;
binary distributions include the above copyright notice this list
of conditions and the following disclaimer in their documentation.
This software is provided ‘as is‘ with no explicit or implied warranties
in respect of its operation including but not limited to correctness
and fitness for purpose.
---------------------------------------------------------------------------
Issue Date: 20/12/2007
*/
#ifndef __GNUC__
# include
#endif
#include
#include “aes.h“
#include “aesaux.h“
#include “aestst.h“
#if defined(__cplusplus)
extern “C“
{
#endif
char *st[8] = { “vk“ “vt“ “nk“ “nt“ “me“ “md“ “me“ “md“ };
char *file_name(char* buf size_t len const unsigned long type const unsigned long blen const unsigned long klen)
{ char *sp;
if(len < 12)
return 0;
sp = copy_str(buf (type < 6 ? “ecb“ : “cbc“));
sp = copy_str(sp st[type]);
*sp++ = (‘0‘ + (char)blen / 4);
*sp++ = (‘0‘ + (char)klen / 4);
sp = copy_str(sp “.txt“);
*sp = ‘\0‘;
return buf;
}
const char *pos(const char *s)
{
while(*s++ != ‘=‘)
;
while(*s++ == ‘ ‘)
;
return s - 1;
}
// Strings to locate lines in test vector files
const char *fstr[NO_LTYPES] =
{ BADL_STR BLEN_STR KLEN_STR TEST_STR IV_STR KEY_STR PT_STR CT_STR };
char *hxx = “0123456789abcdef“;
// Hexadecimal conversion from hex character to a number in range 0 <= no <= 15
int to_hex(int ch)
{
return (ch & 15) + (ch >= ‘0‘ && ch <= ‘9‘ ? 0 : 9);
}
int get_line(FILE *inf char s[])
{
if(feof(inf))
return EXIT_FAILURE;
return fgets(s 100 inf) != s ? EXIT_FAILURE : EXIT_SUCCESS;
}
char *copy_str(char *d const char *s)
{
while(*s)
*d++ = *s++;
*d = ‘\0‘;
return d;
}
char *df_string(const char *f)
{ char *p = f *p1 *p2;
p1 = p2 = 0;
while(*p)
if(*p++ == ‘\\‘)
{
p1 = p2; p2 = p;
}
return (p1 ? p1 : p2 ? p2 : f);
}
// Read from a string of hexadecimal digits into an array of 8-bit bytes
// Each pair of hexadecimal digits is used to compile one 8-bit unsigned char and
// the first (last) digit forms the most (least) significant four bits
// of each unsigned char. The hexadecimal digits are read from left (low) to right
// (high) and are placed in increasing index positions in the unsigned char array
int block_in(unsigned char l[] const char *p)
{ int i = 0;
p = pos(p);
while(*p && *(p + 1) && isxdigit(*p) && isxdigit(*(p + 1)))
{
l[i++] = (to_hex(*p) << 4) + to_hex(*(p + 1))
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
..A..H. 53248 2018-06-22 15:46 AES-Lib\.vs\AES-Lib\v14\.suo
文件 8753 2017-07-21 06:45 AES-Lib\aes\aes.h
文件 8032 2018-06-22 11:36 AES-Lib\aes\aes.vcxproj
文件 2404 2018-06-22 11:36 AES-Lib\aes\aes.vcxproj.filters
文件 165 2018-06-22 11:12 AES-Lib\aes\aes.vcxproj.user
文件 10629 2018-06-19 16:08 AES-Lib\aes\aesaux.c
文件 2749 2017-07-21 06:45 AES-Lib\aes\aesaux.h
文件 10150 2017-07-21 06:45 AES-Lib\aes\aescrypt.c
文件 16030 2017-07-21 06:45 AES-Lib\aes\aeskey.c
文件 27513 2017-07-21 06:45 AES-Lib\aes\aesopt.h
文件 15839 2017-07-21 06:45 AES-Lib\aes\aestab.c
文件 5162 2017-07-21 06:45 AES-Lib\aes\aestab.h
文件 6068 2018-06-22 11:37 AES-Lib\aes\aestst.c
文件 11268 2017-07-21 06:45 AES-Lib\aes\aestst.h
文件 197 2018-06-22 12:02 AES-Lib\aes\aes_main.c
文件 30605 2017-07-21 06:45 AES-Lib\aes\aes_modes.c
文件 18105 2017-07-21 06:45 AES-Lib\aes\aes_ni.c
文件 2519 2017-07-21 06:45 AES-Lib\aes\aes_ni.h
文件 17027 2017-07-21 06:45 AES-Lib\aes\aes_via_ace.h
文件 5164 2017-07-21 06:45 AES-Lib\aes\brg_endian.h
文件 7160 2017-07-21 06:45 AES-Lib\aes\brg_types.h
文件 15966 2018-06-22 14:36 AES-Lib\aes\test_fun.c
文件 162 2018-06-22 15:10 AES-Lib\aes\test_fun.h
文件 2058 2018-06-22 14:42 AES-Lib\AES-Lib.sln
文件 153600 2018-06-21 17:15 AES-Lib\aes_lib_bin\aes.dll
文件 6428 2018-06-21 17:15 AES-Lib\aes_lib_bin\aes.lib
文件 59392 2018-06-22 15:31 AES-Lib\aes_lib_bin\aes_lib_test.exe
文件 366556 2018-06-22 15:31 AES-Lib\aes_lib_bin\aes_lib_test.ilk
文件 634880 2018-06-22 15:31 AES-Lib\aes_lib_bin\aes_lib_test.pdb
文件 153600 2018-06-21 17:15 AES-Lib\aes_lib_bin\dll_generic_c.dll
............此处省略234个文件信息
相关资源
- AES_加密解密控件源代码Delphi.rar
- AES加密BMP图片
- AIR-WLC2100-K9-7-0-252-0-ER.aes
- AES加解密算法软件程序包含全部模式
- AES加密完整Verilog源码
- AES-128加密解密源码及算法详解。
- 高级加密标准AES算法:Rijndael的设计
- AES加密、解密代码实现C、SV、Verilog
- AES算法的FPGA实现与分析_hao
- 联想K29最新1.70BIOS修改版,去白名单验
- SFCipher加解密工具
- 基于AES和SHA的文件加密系统本科毕业
- 高级加密标准AES算法:Rijndael的设计
- 16字节加解密的AES算法.zip
- mbedtls-2.16.5-apache.tgz
- STM32AES加密程序.zip
- AES加解密-CBC模式-文件操作
- AES加密算法的VHDL实现
- 基于ECC&AES混合加密应用系统原创
- AES算法实现源代码
- Altera FPGA多种算法的说明和源码 CORD
- 在ESP32下,使用mbedtls库,测试sha、a
- AES源码包128位,CBC等五种加密方式
- AES解密VerilogHDL源码
- YAESU_FT-857D维修手册.
- RSA和AES混合加密demo
- AES解密硬件实现
- AIR-CT5500-K9-8-0-121-0.aes
- AES加密CBC模式DLL
- OPENSSL AES 加解密例程
评论
共有 条评论