github.com/ledgerwatch/erigon-lib@v1.0.0/pedersen_hash/ffi_utils.h (about) 1 #ifndef STARKWARE_CRYPTO_FFI_UTILS_H_ 2 #define STARKWARE_CRYPTO_FFI_UTILS_H_ 3 4 #include <cstddef> 5 6 #include "pedersen_hash.h" 7 8 #include "gsl-lite.hpp" 9 10 namespace starkware { 11 12 using ValueType = PrimeFieldElement::ValueType; 13 14 /* 15 Handles an error, and outputs a relevant error message as a C string to out. 16 */ 17 int HandleError(const char* msg, gsl::span<gsl::byte> out); 18 19 /* 20 Deserializes a BigInt (PrimeFieldElement::ValueType) from a byte span. 21 */ 22 ValueType Deserialize(const gsl::span<const gsl::byte> span); 23 24 /* 25 Serializes a BigInt (PrimeFieldElement::ValueType) to a byte span. 26 */ 27 void Serialize(const ValueType& val, const gsl::span<gsl::byte> span_out); 28 29 } // namespace starkware 30 31 #endif // STARKWARE_CRYPTO_FFI_UTILS_H_