betteryao/obsolete/GarbledMal.cpp
void GarbledMal::initialize_gen_circuit(const std::vector<Bytes> &ot_keys, const Bytes &gen_inp_mask, const Bytes &seed){
  
  // set the circuit's ot keys
  m_ot_keys = &ot_keys;

  // set the circuit's input mask (is this necessary for new version (BY5)?)
  m_gen_inp_mask = gen_inp_mask;

  // must seed the circuit's random number generator
  m_prng.seed_rand(seed);

  // at this point (now that we have a prng),
  //we can determine the free-XOR value R for the circuit
  Bytes tmp;
  tmp = m_prng.rand_bits(Env::k());
  tmp.set_ith_bit(0,1);
  tmp.resize(16,0);
  m_R = _mm_loadu_si128(reinterpret_cast<const __m128i*>(&tmp[0]));

  // must also pick zero-keys for the constant wires
  tmp = m_prng.rand_bits(Env::k());
  tmp.resize(16, 0);
  m_const_wire[0] = _mm_loadu_si128(reinterpret_cast<const __m128i*>(&tmp[0]));

  tmp = m_prng.rand_bits(Env::k());
  tmp.resize(16, 0);
  m_const_wire[1] = _mm_loadu_si128(reinterpret_cast<const __m128i*>(&tmp[0]));

}
/**
   To initialize an evaluation/garbling circuit, we must
   - set its OT keys,
   - generate the free-XOR offset R,
   - and seed its PRNG.
   - and set Gen's masked input -- why?
   Gen calls this function to initialize all of his circuits.
   Eval calls this function to initialize her check circuits.
 */
To initialize an evaluation/garbling circuit, we must
set its OT keys,
generate the free-XOR offset R,
and seed its PRNG.
and set Gen's masked input -- why.
Gen calls this function to initialize all of his circuits.
Eval calls this function to initialize her check circuits.
To initialize an evaluation / garbling circuit we must set its OT keys generate the free - XOR offset R and seed its PRNG . and set Gen ' s masked input -- why . Gen calls this function to initialize all of his circuits . Eval calls this function to initialize her check circuits .
void GarbledMal::initialize_gen_circuit(const std::vector<Bytes> &ot_keys, const Bytes &gen_inp_mask, const Bytes &seed){
  m_ot_keys = &ot_keys;
  m_gen_inp_mask = gen_inp_mask;
  m_prng.seed_rand(seed);
  Bytes tmp;
  tmp = m_prng.rand_bits(Env::k());
  tmp.set_ith_bit(0,1);
  tmp.resize(16,0);
  m_R = _mm_loadu_si128(reinterpret_cast<const __m128i*>(&tmp[0]));
  tmp = m_prng.rand_bits(Env::k());
  tmp.resize(16, 0);
  m_const_wire[0] = _mm_loadu_si128(reinterpret_cast<const __m128i*>(&tmp[0]));
  tmp = m_prng.rand_bits(Env::k());
  tmp.resize(16, 0);
  m_const_wire[1] = _mm_loadu_si128(reinterpret_cast<const __m128i*>(&tmp[0]));
}
void GarbledMal :: initialize_gen_circuit ( const std :: vector < Bytes > & ot_keys , const Bytes & gen_inp_mask , const Bytes & seed ) { m_ot_keys = & ot_keys ; m_gen_inp_mask = gen_inp_mask ; m_prng . seed_rand ( seed ) ; Bytes tmp ; tmp = m_prng . rand_bits ( Env :: k ( ) ) ; tmp . set_ith_bit ( 0 , 1 ) ; tmp . resize ( 16 , 0 ) ; m_R = _mm_loadu_si128 ( reinterpret_cast < const __m128i * > ( & tmp [ 0 ] ) ) ; tmp = m_prng . rand_bits ( Env :: k ( ) ) ; tmp . resize ( 16 , 0 ) ; m_const_wire [ 0 ] = _mm_loadu_si128 ( reinterpret_cast < const __m128i * > ( & tmp [ 0 ] ) ) ; tmp = m_prng . rand_bits ( Env :: k ( ) ) ; tmp . resize ( 16 , 0 ) ; m_const_wire [ 1 ] = _mm_loadu_si128 ( reinterpret_cast < const __m128i * > ( & tmp [ 0 ] ) ) ; }
To initialize an evaluation/garbling circuit, we must
 set its OT keys,
 generate the free-XOR offset R,
 and seed its PRNG.
To initialize an evaluation / garbling circuit we must set its OT keys generate the free - XOR offset R and seed its PRNG .
// set the circuit's ot keys // set the circuit's input mask (is this necessary for new version (BY5)?) // must seed the circuit's random number generator // at this point (now that we have a prng), //we can determine the free-XOR value R for the circuit // must also pick zero-keys for the constant wires