2025-04-08 20:01:09 +08:00
|
|
|
#include <aes.hpp>
|
|
|
|
#include <string>
|
|
|
|
#include <util.h>
|
|
|
|
|
|
|
|
int main()
|
|
|
|
{
|
|
|
|
std::string key = "sss";
|
|
|
|
uint8_t ik[32]{};
|
|
|
|
hash(key.c_str(), ik);
|
|
|
|
|
|
|
|
char* msg = new char[256]{};
|
2025-04-08 22:09:03 +08:00
|
|
|
memset(msg, 0, 256);
|
2025-04-08 20:01:09 +08:00
|
|
|
auto len = std::snprintf(msg + 12, 256, "%s", "hello world");
|
|
|
|
std::cout << encrypt(ik, (uint8_t*)msg, len + 12) << std::endl;
|
2025-04-08 22:09:03 +08:00
|
|
|
std::cout << msg + 12 << std::endl;
|
|
|
|
|
2025-04-08 20:01:09 +08:00
|
|
|
|
|
|
|
uint8_t ik2[32]{};
|
|
|
|
hash(key.c_str(), ik2);
|
|
|
|
|
|
|
|
std::cout << decrypt(ik2, (uint8_t*)msg, len + 12) << std::endl;
|
|
|
|
|
2025-04-08 22:09:03 +08:00
|
|
|
std::cout << msg + 12 << std::endl;
|
|
|
|
|
2025-04-08 20:01:09 +08:00
|
|
|
return 0;
|
|
|
|
}
|