Zeth - Zerocash on Ethereum
0.8
Reference implementation of the Zeth protocol by Clearmatics
|
Go to the documentation of this file.
5 #ifndef __ZETH_CORE_BITS_HPP__
6 #define __ZETH_CORE_BITS_HPP__
19 template<
size_t numBits>
class bits;
22 template<
size_t numBits>
26 template<
size_t numBits>
31 template<
size_t numBits>
class bits :
public std::array<bool, numBits>
38 template<
typename... boolList>
bits(
const boolList &...
bits);
55 template<
typename FieldT>
57 libsnark::protoboard<FieldT> &pb,
58 libsnark::pb_variable_array<FieldT> &var_array)
const;
61 template<
typename boolIt>
explicit bits(boolIt it);
64 friend bits bits_xor<numBits>(
const bits &,
const bits &);
65 friend bits bits_add<numBits>(
const bits &,
const bits &,
bool);
92 const std::vector<bool> &
bits, std::ostream &out_s);
98 #endif // __ZETH_CORE_BITS_HPP__
static bits from_size_t(size_t addr)
std::vector< bool > to_vector() const
static bits from_vector(const std::vector< bool > &bin)
Generic class representing a bit-array of a specific size.
bits< numBits > bits_xor(const bits< numBits > &a, const bits< numBits > &b)
XOR two binary strings of the same length.
std::vector< bool > bit_vector_from_size_t_be(size_t x)
Returns the big endian binary encoding of the integer x.
bits< numBits > bits_add(const bits< numBits > &a, const bits< numBits > &b, bool with_carry=false)
Sum 2 binary strings with or without carry.
void bit_vector_write_string(const std::vector< bool > &bits, std::ostream &out_s)
std::vector< bool > bit_vector_from_size_t_le(size_t x)
Returns the little endian binary encoding of the integer x.
std::vector< bool > bit_vector_from_hex(const std::string &hex_str)
void fill_pb_variable_array(libsnark::protoboard< FieldT > &pb, libsnark::pb_variable_array< FieldT > &var_array) const
static bits from_hex(const std::string &hex)
void fill_from_iterator(boolIt it)