diff --git a/blockchain_integration/pi_network/dapi/crypto/hash_based/crypto.cpp b/blockchain_integration/pi_network/dapi/crypto/hash_based/crypto.cpp new file mode 100644 index 000000000..c44ef133e --- /dev/null +++ b/blockchain_integration/pi_network/dapi/crypto/hash_based/crypto.cpp @@ -0,0 +1,31 @@ +#include "crypto.h" +#include +#include + +Crypto::Crypto() {} + +Crypto::~Crypto() {} + +std::vector Crypto::sha256(const std::vector& input) { + NTL::SHA256 sha256; + sha256.update(input); + std::vector hash = sha256.final(); + return hash; +} + +std::vector Crypto::keccak256(const std::vector& input) { + NTL::Keccak keccak; + keccak.update(input); + std::vector hash = keccak.final(); + return hash; +} + +std::vector Crypto::sign(const std::vector& message, const NTL::ZZ& privateKey) { + // Implement digital signature algorithm (e.g. ECDSA) + return std::vector(); +} + +bool Crypto::verify(const std::vector& message, const std::vector& signature, const NTL::ZZ& publicKey) { + // Implement digital signature verification algorithm (e.g. ECDSA) + return true; +}