Zeth - Zerocash on Ethereum  0.8
Reference implementation of the Zeth protocol by Clearmatics
proto_utils.cpp
Go to the documentation of this file.
1 // Copyright (c) 2015-2022 Clearmatics Technologies Ltd
2 //
3 // SPDX-License-Identifier: LGPL-3.0+
4 
6 
7 #include <libff/algebra/curves/alt_bn128/alt_bn128_pp.hpp>
8 #include <libff/algebra/curves/bls12_377/bls12_377_pp.hpp>
9 #include <libff/algebra/curves/bw6_761/bw6_761_pp.hpp>
10 
11 namespace libzeth
12 {
13 
14 // Note, any attempt to call an implementation not given will result in a
15 // linker error.
16 
17 template<> std::string pp_name<libff::alt_bn128_pp>()
18 {
19  return std::string("alt-bn128");
20 }
21 
22 template<> std::string pp_name<libff::bls12_377_pp>()
23 {
24  return std::string("bls12-377");
25 }
26 
27 template<> std::string pp_name<libff::bw6_761_pp>()
28 {
29  return std::string("bw6-761");
30 }
31 
32 zeth_note zeth_note_from_proto(const zeth_proto::ZethNote &note)
33 {
34  return zeth_note(
35  bits256::from_hex(note.apk()),
36  bits64::from_hex(note.value()),
37  bits256::from_hex(note.rho()),
38  bits256::from_hex(note.trap_r()));
39 }
40 
41 } // namespace libzeth
libzeth
Definition: binary_operation.hpp:15
proto_utils.hpp
libzeth::zeth_note_from_proto
zeth_note zeth_note_from_proto(const zeth_proto::ZethNote &note)
Definition: proto_utils.cpp:32
libzeth::zeth_note
Definition: note.hpp:15
libzeth::bits< 256 >::from_hex
static bits from_hex(const std::string &hex)