91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 17KB
    文件類型: .zip
    金幣: 2
    下載: 0 次
    發布日期: 2021-06-06
  • 語言: C/C++
  • 標簽: AES128??AES??encryption??AES??

資源簡介

aes.c aes.h test.c 本人實測可以使用,基于C的AES算法代碼,希望能幫到有需要的。以下是相關模式調用的函數。 void AES_init_ctx(struct AES_ctx* ctx, const uint8_t* key); void AES_init_ctx_iv(struct AES_ctx* ctx, const uint8_t* key, const uint8_t* iv); void AES_ctx_set_iv(struct AES_ctx* ctx, const uint8_t* iv); void AES_ECB_encrypt(const struct AES_ctx* ctx, uint8_t* buf); void AES_ECB_decrypt(const struct AES_ctx* ctx, uint8_t* buf); void AES_CBC_encrypt_buffer(struct AES_ctx* ctx, uint8_t* buf, uint32_t length); void AES_CBC_decrypt_buffer(struct AES_ctx* ctx, uint8_t* buf, uint32_t length); void AES_CTR_xcrypt_buffer(struct AES_ctx* ctx, uint8_t* buf, uint32_t length);

資源截圖

代碼片段和文件信息

/*

This?is?an?implementation?of?the?AES?algorithm?specifically?ECB?CTR?and?CBC?mode.
Block?size?can?be?chosen?in?aes.h?-?available?choices?are?AES128?AES192?AES256.

The?implementation?is?verified?against?the?test?vectors?in:
??National?Institute?of?Standards?and?Technology?Special?Publication?800-38A?2001?ED

ECB-AES128
----------

??plain-text:
????6bc1bee22e409f96e93d7e117393172a
????ae2d8a571e03ac9c9eb76fac45af8e51
????30c81c46a35ce411e5fbc1191a0a52ef
????f69f2445df4f9b17ad2b417be66c3710

??key:
????2b7e151628aed2a6abf7158809cf4f3c

??resulting?cipher
????3ad77bb40d7a3660a89ecaf32466ef97?
????f5d3d58503b9699de785895a96fdbaaf?
????43b1cd7f598ece23881b00e3ed030688?
????7b0c785e27e8ad3f8223207104725dd4?


NOTE:???String?length?must?be?evenly?divisible?by?16byte?(str_len?%?16?==?0)
????????You?should?pad?the?end?of?the?string?with?zeros?if?this?is?not?the?case.
????????For?AES192/256?the?key?size?is?proportionally?larger.

*/


/*****************************************************************************/
/*?Includes:?????????????????????????????????????????????????????????????????*/
/*****************************************************************************/
#include??//?CBC?mode?for?memset
#include?“aes.h“

/*****************************************************************************/
/*?Defines:??????????????????????????????????????????????????????????????????*/
/*****************************************************************************/
//?The?number?of?columns?comprising?a?state?in?AES.?This?is?a?constant?in?AES.?Value=4
#define?Nb?4

#if?defined(AES256)?&&?(AES256?==?1)
????#define?Nk?8
????#define?Nr?14
#elif?defined(AES192)?&&?(AES192?==?1)
????#define?Nk?6
????#define?Nr?12
#else
????#define?Nk?4????????//?The?number?of?32?bit?words?in?a?key.
????#define?Nr?10???????//?The?number?of?rounds?in?AES?Cipher.
#endif

//?jcallan@github?points?out?that?declaring?Multiply?as?a?function?
//?reduces?code?size?considerably?with?the?Keil?ARM?compiler.
//?See?this?link?for?more?information:?https://github.com/kokke/tiny-AES-C/pull/3
#ifndef?MULTIPLY_AS_A_FUNCTION
??#define?MULTIPLY_AS_A_FUNCTION?0
#endif




/*****************************************************************************/
/*?Private?variables:????????????????????????????????????????????????????????*/
/*****************************************************************************/
//?state?-?array?holding?the?intermediate?results?during?decryption.
typedef?uint8_t?state_t[4][4];



//?The?lookup-tables?are?marked?const?so?they?can?be?placed?in?read-only?storage?instead?of?RAM
//?The?numbers?below?can?be?computed?dynamically?trading?ROM?for?RAM?-?
//?This?can?be?useful?in?(embedded)?bootloader?applications?where?ROM?is?often?limited.
static?const?uint8_t?sbox[256]?=?{
??//0?????1????2??????3?????4????5?????6?????7??????8????9?????A??????B????C?????D?????E?????F
??0x63?0x7c?0x77?0x7b?0xf2?0x6b?0x6f?0xc5?0x30?0x01?0x67?0x2b?0xfe?0xd7?0xab?0x76
??0xca

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2020-07-01?10:34??tiny-AES-c-master\
?????文件??????????44??2020-07-01?10:34??tiny-AES-c-master\.gitignore
?????文件?????????366??2020-07-01?10:34??tiny-AES-c-master\CMakeLists.txt
?????文件????????1211??2020-07-01?10:34??tiny-AES-c-master\Makefile
?????文件????????4319??2020-07-01?10:34??tiny-AES-c-master\README.md
?????文件???????18963??2020-07-01?10:34??tiny-AES-c-master\aes.c
?????文件????????2776??2020-07-01?10:34??tiny-AES-c-master\aes.h
?????文件?????????184??2020-07-01?10:34??tiny-AES-c-master\aes.hpp
?????文件????????2050??2020-07-01?10:34??tiny-AES-c-master\conanfile.py
?????文件?????????279??2020-07-01?10:34??tiny-AES-c-master\library.json
?????文件?????????557??2020-07-01?10:34??tiny-AES-c-master\library.properties
?????文件???????15539??2020-07-01?10:34??tiny-AES-c-master\test.c
?????文件??????????37??2020-07-01?10:34??tiny-AES-c-master\test.cpp
?????目錄???????????0??2020-07-01?10:34??tiny-AES-c-master\test_package\
?????文件?????????313??2020-07-01?10:34??tiny-AES-c-master\test_package\CMakeLists.txt
?????文件?????????413??2020-07-01?10:34??tiny-AES-c-master\test_package\conanfile.py
?????文件????????1211??2020-07-01?10:34??tiny-AES-c-master\unlicense.txt

評論

共有 條評論