mirror of
https://github.com/hoytech/strfry.git
synced 2025-06-19 01:34:57 +00:00
don't use deprecated OpenSSL functions
This commit is contained in:
@ -1,5 +1,6 @@
|
|||||||
#include "events.h"
|
#include <openssl/sha.h>
|
||||||
|
|
||||||
|
#include "events.h"
|
||||||
|
|
||||||
|
|
||||||
std::string nostrJsonToFlat(const tao::json::value &v) {
|
std::string nostrJsonToFlat(const tao::json::value &v) {
|
||||||
@ -62,12 +63,9 @@ std::string nostrHash(const tao::json::value &origJson) {
|
|||||||
std::string encoded = tao::json::to_string(arr);
|
std::string encoded = tao::json::to_string(arr);
|
||||||
|
|
||||||
unsigned char hash[SHA256_DIGEST_LENGTH];
|
unsigned char hash[SHA256_DIGEST_LENGTH];
|
||||||
SHA256_CTX sha256;
|
SHA256(reinterpret_cast<unsigned char*>(encoded.data()), encoded.size(), hash);
|
||||||
SHA256_Init(&sha256);
|
|
||||||
SHA256_Update(&sha256, encoded.data(), encoded.size());
|
|
||||||
SHA256_Final(hash, &sha256);
|
|
||||||
|
|
||||||
return std::string(((char*)hash), SHA256_DIGEST_LENGTH);
|
return std::string(reinterpret_cast<char*>(hash), SHA256_DIGEST_LENGTH);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool verifySig(secp256k1_context* ctx, std::string_view sig, std::string_view hash, std::string_view pubkey) {
|
bool verifySig(secp256k1_context* ctx, std::string_view sig, std::string_view hash, std::string_view pubkey) {
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <openssl/sha.h>
|
|
||||||
#include <secp256k1_schnorrsig.h>
|
#include <secp256k1_schnorrsig.h>
|
||||||
|
|
||||||
#include "golpe.h"
|
#include "golpe.h"
|
||||||
|
Reference in New Issue
Block a user