Zeth - Zerocash on Ethereum  0.8
Reference implementation of the Zeth protocol by Clearmatics
Public Member Functions | Static Public Member Functions | Protected Member Functions | Friends | List of all members
libzeth::bits< numBits > Class Template Reference

Generic class representing a bit-array of a specific size. More...

#include <bits.hpp>

Public Member Functions

 bits ()
 
template<typename... boolList>
 bits (const boolList &...bits)
 Construct from initializer-list. More...
 
std::vector< bool > to_vector () const
 
bool is_zero () const
 
template<typename FieldT >
void fill_pb_variable_array (libsnark::protoboard< FieldT > &pb, libsnark::pb_variable_array< FieldT > &var_array) const
 

Static Public Member Functions

static bits from_vector (const std::vector< bool > &bin)
 
static bits from_hex (const std::string &hex)
 
static bits from_size_t (size_t addr)
 

Protected Member Functions

template<typename boolIt >
 bits (boolIt it)
 
template<typename boolIt >
void fill_from_iterator (boolIt it)
 

Friends

bits bits_xor (const bits &, const bits &)
 XOR two binary strings of the same length. More...
 
bits bits_add (const bits &, const bits &, bool)
 Sum 2 binary strings with or without carry. More...
 

Detailed Description

template<size_t numBits>
class libzeth::bits< numBits >

Generic class representing a bit-array of a specific size.

Definition at line 19 of file bits.hpp.

Constructor & Destructor Documentation

◆ bits() [1/3]

template<size_t numBits>
libzeth::bits< numBits >::bits ( )

◆ bits() [2/3]

template<size_t numBits>
template<typename... boolList>
libzeth::bits< numBits >::bits ( const boolList &...  bits)

Construct from initializer-list.

◆ bits() [3/3]

template<size_t numBits>
template<typename boolIt >
libzeth::bits< numBits >::bits ( boolIt  it)
explicitprotected

Member Function Documentation

◆ fill_from_iterator()

template<size_t numBits>
template<typename boolIt >
void libzeth::bits< numBits >::fill_from_iterator ( boolIt  it)
protected

◆ fill_pb_variable_array()

template<size_t numBits>
template<typename FieldT >
void libzeth::bits< numBits >::fill_pb_variable_array ( libsnark::protoboard< FieldT > &  pb,
libsnark::pb_variable_array< FieldT > &  var_array 
) const

Fill a libsnark::pb_variable_array with bits from this container, representing each as 1 or 0 in FieldT.

◆ from_hex()

template<size_t numBits>
static bits libzeth::bits< numBits >::from_hex ( const std::string &  hex)
static

◆ from_size_t()

template<size_t numBits>
static bits libzeth::bits< numBits >::from_size_t ( size_t  addr)
static

Create a bits object from a size_t, specifically for bits_addr type. Only available for TreeDepth small enough that TreeDepth bits can be expressed in size_t.

◆ from_vector()

template<size_t numBits>
static bits libzeth::bits< numBits >::from_vector ( const std::vector< bool > &  bin)
static

◆ is_zero()

template<size_t numBits>
bool libzeth::bits< numBits >::is_zero ( ) const
Here is the caller graph for this function:

◆ to_vector()

template<size_t numBits>
std::vector<bool> libzeth::bits< numBits >::to_vector ( ) const

Friends And Related Function Documentation

◆ bits_add

template<size_t numBits>
bits bits_add ( const bits< numBits > &  ,
const bits< numBits > &  ,
bool   
)
friend

Sum 2 binary strings with or without carry.

◆ bits_xor

template<size_t numBits>
bits bits_xor ( const bits< numBits > &  ,
const bits< numBits > &   
)
friend

XOR two binary strings of the same length.


The documentation for this class was generated from the following file: