Skip to content

Commit

Permalink
Create crypto.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
KOSASIH authored Aug 6, 2024
1 parent 764ce35 commit 0640461
Showing 1 changed file with 31 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#include "crypto.h"
#include <NTL/SHA.h>
#include <NTL/Keccak.h>

Crypto::Crypto() {}

Crypto::~Crypto() {}

std::vector<NTL::ZZ> Crypto::sha256(const std::vector<NTL::ZZ>& input) {
NTL::SHA256 sha256;
sha256.update(input);
std::vector<NTL::ZZ> hash = sha256.final();
return hash;
}

std::vector<NTL::ZZ> Crypto::keccak256(const std::vector<NTL::ZZ>& input) {
NTL::Keccak keccak;
keccak.update(input);
std::vector<NTL::ZZ> hash = keccak.final();
return hash;
}

std::vector<NTL::ZZ> Crypto::sign(const std::vector<NTL::ZZ>& message, const NTL::ZZ& privateKey) {
// Implement digital signature algorithm (e.g. ECDSA)
return std::vector<NTL::ZZ>();
}

bool Crypto::verify(const std::vector<NTL::ZZ>& message, const std::vector<NTL::ZZ>& signature, const NTL::ZZ& publicKey) {
// Implement digital signature verification algorithm (e.g. ECDSA)
return true;
}

0 comments on commit 0640461

Please sign in to comment.