client/cpp/openssl_hash_impl.cc
// Of type HmacFunc in rappor_deps.h
//
// The length of the passed-in output vector determines how many
// bytes are returned.
//
// No reseed operation, but recommended reseed_interval <= 2^48 updates.
// Since we're seeding for each value and typically don't need
// so many bytes, we should be OK.
Of type HmacFunc in rappor_deps.h
The length of the passed-in output vector determines how many
bytes are returned.

No reseed operation, but recommended reseed_interval <= 2^48 updates.
Since we're seeding for each value and typically don't need
so many bytes, we should be OK.
Of type HmacFunc in rappor_deps . h The length of the passed - in output vector determines how many bytes are returned . No reseed operation but recommended reseed_interval < = 2^48 updates . Since we ' re seeding for each value and typically don ' t need so many bytes we should be OK .
bool HmacDrbg(const std::string& key, const std::string& value,
              std::vector<uint8_t>* output) {
  const unsigned char k_array[] = {
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
  };
  std::string v;
  std::vector<uint8_t> temp_output;
  int num_bytes = output->size();
  if (num_bytes == 0) {
    num_bytes = 32;
  }
  v.append(32u, 0x01);
  temp_output.resize(32, 0);
  std::string temp_str(v);
  temp_str.append(std::string("\0", 1));
  temp_str.append(key);
  temp_str.append(value);
  output->resize(0);
  if (!HmacSha256(std::string(k_array, k_array + 32), temp_str, &temp_output)) {
    return false;
  }
  std::string k(temp_output.begin(), temp_output.end());
  if (!HmacSha256(k, v, &temp_output)) {
    return false;
  }
  v = std::string(temp_output.begin(), temp_output.end());
  if (!HmacSha256(k, v + std::string("\1", 1) + key + value, &temp_output)) {
    return false;
  }
  k = std::string(temp_output.begin(), temp_output.end());
  if (!HmacSha256(k, v, &temp_output)) {
    return false;
  }
  v = std::string(temp_output.begin(), temp_output.end());
  while (output->size() < num_bytes) {
    if (!HmacSha256(k, v, &temp_output)) {
      return false;
    }
    v = std::string(temp_output.begin(), temp_output.end());
    output->insert(output->end(), temp_output.begin(), temp_output.end());
  }
  output->resize(num_bytes);
  return true;
}
bool HmacDrbg ( const std :: string & key , const std :: string & value , std :: vector < uint8_t > * output ) { const unsigned char k_array [ ] = { 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 } ; std :: string v ; std :: vector < uint8_t > temp_output ; int num_bytes = output -> size ( ) ; if ( num_bytes == 0 ) { num_bytes = 32 ; } v . append ( 32u , 0x01 ) ; temp_output . resize ( 32 , 0 ) ; std :: string temp_str ( v ) ; temp_str . append ( std :: string ( " \0 " , 1 ) ) ; temp_str . append ( key ) ; temp_str . append ( value ) ; output -> resize ( 0 ) ; if ( ! HmacSha256 ( std :: string ( k_array , k_array + 32 ) , temp_str , & temp_output ) ) { return false ; } std :: string k ( temp_output . begin ( ) , temp_output . end ( ) ) ; if ( ! HmacSha256 ( k , v , & temp_output ) ) { return false ; } v = std :: string ( temp_output . begin ( ) , temp_output . end ( ) ) ; if ( ! HmacSha256 ( k , v + std :: string ( " \1 " , 1 ) + key + value , & temp_output ) ) { return false ; } k = std :: string ( temp_output . begin ( ) , temp_output . end ( ) ) ; if ( ! HmacSha256 ( k , v , & temp_output ) ) { return false ; } v = std :: string ( temp_output . begin ( ) , temp_output . end ( ) ) ; while ( output -> size ( ) < num_bytes ) { if ( ! HmacSha256 ( k , v , & temp_output ) ) { return false ; } v = std :: string ( temp_output . begin ( ) , temp_output . end ( ) ) ; output -> insert ( output -> end ( ) , temp_output . begin ( ) , temp_output . end ( ) ) ; } output -> resize ( num_bytes ) ; return true ; }
Of type HmacFunc in rappor_deps.h
The length of the passed-in output vector determines how many
bytes are returned.
Of type HmacFunc in rappor_deps . h The length of the passed - in output vector determines how many bytes are returned .
// By default return 32 bytes for Uint32 applications. // provided_data is key|value. // Instantiate. // Generate.