feat(crypto,archive): implement VL-007 built-in hashes and VL-006 archive creation/gzip/tar fallback

This commit is contained in:
faumaray committed 2026-11-26 20:55:45 +03:00
1 parent b50131f52e
commit 22c8538754
19 files changed
+3326 -133

No files matched your search

+23 -13
View File
@@ -9,23 +9,33 @@ int main()
if (!digest.has_value() || digest->size() != 32) {
return 1;
}
auto key = Void::Crypto::Ed25519PrivateKey::generate();
if (!key.has_value()) {
return 2;
}
auto pub = key->public_key();
if (!pub.has_value()) {
return 3;
auto b2 = Void::Crypto::blake2b256("abc");
if (!b2.has_value() || b2->size() != 32) {
return 6;
}
const std::array<std::byte, 4> msg{std::byte{1}, std::byte{2}, std::byte{3},
std::byte{4}};
auto sig = Void::Crypto::sign_ed25519(msg, *key);
if (!sig.has_value()) {
return 4;
auto mac = Void::Crypto::hmac_sha256(msg, msg);
if (!mac.has_value() || mac->size() != Void::Crypto::HmacSha256Size) {
return 7;
}
auto ok = Void::Crypto::verify_ed25519(msg, *sig, *pub);
if (!ok.has_value() || !*ok) {
return 5;
if (Void::Crypto::has_openssl_backend()) {
auto key = Void::Crypto::Ed25519PrivateKey::generate();
if (!key.has_value()) {
return 2;
}
auto pub = key->public_key();
if (!pub.has_value()) {
return 3;
}
auto sig = Void::Crypto::sign_ed25519(msg, *key);
if (!sig.has_value()) {
return 4;
}
auto ok = Void::Crypto::verify_ed25519(msg, *sig, *pub);
if (!ok.has_value() || !*ok) {
return 5;
}
}
return 0;
}