之前不太了解arduino,使用第三方md5库加密。
https://github.com/tzikis/ArduinoMD5 https://github.com/tzikis/ArduinoMD5
#include "MD5.h"
//houyawei 2021.10.29
unsigned char* hash = MD5::make_hash((char *)md.c_str());
char *test = MD5::make_digest(hash, 16);
printf("test:%s\r\n",test);
生产环境遇到了问题,加密次数过多会导致esp32概率性崩溃,无法在程序内修复,只能看门狗重启或断电重启恢复。此异常导致串口不断有错误数据。
之后看到arduino_esp32库里面自带md5加密算法的。
#include "MD5Builder.h"
MD5Builder md5;
md5.begin();
md5.add(md);
md5.calculate();
//const char *md5str = md5.toString().c_str();
//printf("%s\r\n",md5str);
//houyawei
使用官方算法后没有再遇到而esp32异常的问题。
参考链接:
https://github.com/esp8266/Arduino/issues/1349 https://github.com/esp8266/Arduino/issues/1349
---------houyawei 2021.10.29
原文地址:https://blog.csdn.net/u011738895/article/details/121038037
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。