Веб-сайт самохостера Lotigara

summaryrefslogtreecommitdiff
path: root/source/core/StarCurve25519.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/core/StarCurve25519.hpp')
-rw-r--r--source/core/StarCurve25519.hpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/source/core/StarCurve25519.hpp b/source/core/StarCurve25519.hpp
new file mode 100644
index 0000000..15fe4d1
--- /dev/null
+++ b/source/core/StarCurve25519.hpp
@@ -0,0 +1,25 @@
+#ifndef STAR_CURVE_25519_HPP
+#define STAR_CURVE_25519_HPP
+#include "StarEncode.hpp"
+#include "StarByteArray.hpp"
+#include "StarArray.hpp"
+
+namespace Star::Curve25519 {
+
+constexpr size_t PublicKeySize = 32;
+constexpr size_t SecretKeySize = 32;
+constexpr size_t PrivateKeySize = 64;
+constexpr size_t SignatureSize = 64;
+
+typedef Array<uint8_t, PublicKeySize> PublicKey;
+typedef Array<uint8_t, SecretKeySize> SecretKey;
+typedef Array<uint8_t, PrivateKeySize> PrivateKey;
+typedef Array<uint8_t, SignatureSize> Signature;
+
+PublicKey const& publicKey();
+Signature sign(void* data, size_t len);
+bool verify(uint8_t const* signature, uint8_t const* publicKey, void* data, size_t len);
+
+}
+
+#endif \ No newline at end of file