[STM32F1] FEA加密算法stm32开放下载FEA32工程源码

[复制链接]
489|2
 楼主| hotpower 发表于 2023-10-12 22:53 | 显示全部楼层 |阅读模式
本帖最后由 hotpower 于 2023-10-14 21:25 编辑

点击下载:https://bbs.21ic.com/icview-3332854-1-1.html
  1. FEA32Lib.h

  2. /*
  3. BytesEncrypt字节流加密函数
  4. buffer输入为明文,输出为密文。明文密文共用。
  5. len为明文长度。
  6. mainkey为系统主密钥或用户自定义主密钥。
  7. bits为主密钥位数32-2048位。
  8. subkey为32位子密钥输入。
  9. 函数返回32位子密钥,级联时需要。
  10. */
  11. unsigned int BytesEncrypt(unsigned char* buffer, int len, unsigned char* mainkey, int bits, unsigned int subkey);
  12. /*
  13. BytesDecrypt字节流解密函数
  14. buffer输入为密文,输出为明文。明文密文共用。
  15. len为密文长度。
  16. mainkey为系统主密钥或用户自定义主密钥。
  17. bits为主密钥位数32-2048位。
  18. subkey为32位子密钥输入。
  19. 函数返回32位子密钥,级联时需要。
  20. */
  21. unsigned int BytesDecrypt(unsigned char* buffer, int len, unsigned char* mainkey, int bits, unsigned int subkey);


  1. main.c

  2. //#include "STM32F10x.h"    // Device header
  3. #include <stdio.h>
  4. #include <stdint.h>
  5. #include "FEA32Lib.h"

  6. /*-----------------------------------------------------------------------------------------------
  7.               HotFEA加解密程序_FEA32 HotPower[url=home.php?mod=space&uid=516618]@163.com[/url] 2023-10-12 22:11:54于北京
  8. ----------------------------------------------------------------------------------------------*/

  9. const unsigned char FEAMainKeyArray[16] = {//系统默认FEA32的32位主密钥,自定义128位主密钥(可以自定义32-2048位主密钥)
  10.   0x7D, 0x35, 0x82, 0x36, 0xA6, 0x05, 0x0F, 0xB8, 0x2B, 0x52, 0x50, 0x5D, 0x5B, 0x63, 0x3F, 0x8D
  11. };

  12. unsigned int FEASubKeyEncrypt = 0xB7073293;//系统默认FEA的32位加密子密钥,可以自定义32位加密子密钥
  13. unsigned int FEASubKeyDecrypt = 0xB7073293;//系统默认FEA的32位解密子密钥,可以自定义32位解密子密钥

  14. unsigned char FEATextBuffers[1024] = {//明文数组1024个字节        ,外部存储器
  15.   0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39
  16. };

  17. int main (void) {
  18. int i;
  19.         BytesEncrypt(FEATextBuffers, 1024, (unsigned char*)FEAMainKeyArray, 128, FEASubKeyEncrypt);//自定义128位主密钥,不级联
  20.         BytesDecrypt(FEATextBuffers, 1024, (unsigned char*)FEAMainKeyArray, 128, FEASubKeyDecrypt);//自定义128位主密钥,不级联
  21. //加解密函数速率50KB/S
  22.         for(i = 0;i < 25;i++){
  23.                 FEASubKeyEncrypt = BytesEncrypt(FEATextBuffers, 1024, (unsigned char*)FEAMainKeyArray, 128, FEASubKeyEncrypt);//自定义128位主密钥,级联
  24.                 FEASubKeyDecrypt = BytesDecrypt(FEATextBuffers, 1024, (unsigned char*)FEAMainKeyArray, 128, FEASubKeyDecrypt);//自定义128位主密钥,级联
  25.         }
  26.   for(i = 0;i < 16;i++){
  27.     if(i == 0) printf ("%02X", FEATextBuffers[i]);
  28.                 else printf (", %02X", FEATextBuffers[i]);
  29.   }
  30.         printf ("\n");
  31.   while (1) {
  32.     printf ("End\n");   /* Print "Hello World" */
  33.   }
  34. }


FEA32纯软件仿真.png
FEA32启动文件.png
FEA32主程序main.png
FEA32库头文件FEALib.png
专利截图.jpg
cr315 发表于 2023-10-13 15:47 | 显示全部楼层
发明专利证书都上来了
MessageRing 发表于 2023-10-13 21:58 | 显示全部楼层
这个专利是?
您需要登录后才可以回帖 登录 | 注册

本版积分规则

个人签名:[url=http://www.21ic.com/tools/HotWC3_V1.23.html]

1460

主题

21617

帖子

508

粉丝
快速回复 在线客服 返回列表 返回顶部