From ee5b3d683cc480c5eacc8cc0b9fc5f7a197901fd Mon Sep 17 00:00:00 2001 From: Michael Jurkoic Date: Wed, 13 Mar 2024 09:00:53 -0500 Subject: Use SHA256 hashing function for OpenSSL >= 3.0 --- src/event.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'src/event.cpp') diff --git a/src/event.cpp b/src/event.cpp index a95657e..eb6d998 100644 --- a/src/event.cpp +++ b/src/event.cpp @@ -1,9 +1,9 @@ #include +#include #include #include #include #include -#include #include "nostr.hpp" @@ -87,10 +87,7 @@ void Event::validate() string Event::generateId(string serializedData) const { unsigned char hash[SHA256_DIGEST_LENGTH]; - SHA256_CTX sha256; - SHA256_Init(&sha256); - SHA256_Update(&sha256, serializedData.c_str(), serializedData.length()); - SHA256_Final(hash, &sha256); + EVP_Digest(serializedData.c_str(), serializedData.length(), hash, NULL, EVP_sha256(), NULL); stringstream ss; for (int i = 0; i < SHA256_DIGEST_LENGTH; i++) -- cgit