Improve crypto primitives
This commit is contained in:
parent
bd5a8d52cc
commit
6256b6ef33
@ -10,10 +10,18 @@
|
||||
struct PrivateKey {
|
||||
|
||||
/// @brief The size of a private key
|
||||
static const int size = 32;
|
||||
static constexpr int size = 32;
|
||||
|
||||
uint8_t bytes[size];
|
||||
|
||||
bool isUnset() {
|
||||
for (uint8_t i = 0; i < size; i += 1) {
|
||||
if (bytes[i] != 0) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
@ -22,10 +30,18 @@ struct PrivateKey {
|
||||
struct PublicKey {
|
||||
|
||||
/// @brief The size of a public key
|
||||
static const int size = 32;
|
||||
static constexpr int size = 32;
|
||||
|
||||
uint8_t bytes[size];
|
||||
|
||||
bool isUnset() {
|
||||
for (uint8_t i = 0; i < size; i += 1) {
|
||||
if (bytes[i] != 0) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
@ -34,7 +50,7 @@ struct PublicKey {
|
||||
struct Signature {
|
||||
|
||||
/// @brief The size of a message signature
|
||||
static const int size = 64;
|
||||
static constexpr int size = 64;
|
||||
|
||||
uint8_t bytes[size];
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user