Hash functions for distributed Boneh Franklin IBC

March 16, 2013 | Posted in Asynchronous Key Generation for IBE

These are the hash functions that are needed to implement the Boneh-Franklin IBC after the distributed share generation.

H1 : {0,1} -> G2

H2 : GT -> {0,1}^l, l = 20

H3 : {0,1}^l X {0,1}^l -> Zp

H4 : {0,1}^l -> {0,1}^l

This is the C code of the hash functions using the PBC library :

void hash1(char * b){
  /* Mathematically
   * H1 : {0,1}* -> G2*
   * This function will take an input as char, hash it and
   * convert it into a element h1 in G2.
   */
  unsigned char h[20];
  SHA1(b, sizeof(b), h);
  element_from_hash(h1, h, 20);
}

void hash2(unsigned char *b){
  /* Mathematically,
   * H2 : GT -> {0,1}^l, l = 20
   * This function will take a GT value stored in an element h2gt
   * and store a 20 byte hash in the unsigned char b
   */
  unsigned char temp[128];
  element_to_bytes(temp, h2gt);
  SHA1(temp, sizeof(temp), b);
}

void hash3(unsigned char * b1, unsigned char * b2){
  /* Mathematically,
   * H3 : {0,1}^l X {0,1}^l -> Zp
   * This function will take two binary strings and generate an element
   * of Zr and store it in h3zr
   */
  int i;
  unsigned char rnd[20];
  for(i=0; i<20; i++){
    rnd[i] = b1[i] ^ b2[i];
  }
  element_from_bytes(h3zr, rnd);
}

void hash4(unsigned char * b, unsigned char * hb){
  /* Mathematically,
   * H4 : {0,1}^l -> {0,1}^l
   * This function will take a 20 byte string, and return its hash
   * back to hb.
   */
  SHA1(b, sizeof(b), hb);
}

void init_hashes(){
  element_init_G2(h1, pairing);
  element_init_GT(h2gt, pairing);
  element_init_Zr(h3zr, pairing);
}

Related Posts

29 Jul 2013 » Overlapping collisions

16 Mar 2013 » Decryption for distributed Boneh-Franklin IBC

16 Mar 2013 » Encryption for distributed Boneh-Franklin IBC

05 Mar 2013 » Importing and exporting an element in PBC

02 Mar 2013 » Using python to complete IBC

27 Feb 2013 » Modifying a DKG header

23 Feb 2013 » Analyzing messages in DKG

23 Feb 2013 » Understanding DKG

20 Feb 2013 » Pseudo code for the mathematical functions

20 Feb 2013 » Distributed Key Generation in BFIBC

19 Feb 2013 » Algorithm to Generate IBC Keyshares

19 Feb 2013 » Modifying the DKG protocol

19 Feb 2013 » The DKG protocol, in short

19 Feb 2013 » The DKG Protocol

19 Feb 2013 » Asynchronous Distributed Key Generation for Identity-Based Cryptography

19 Feb 2013 » Distributed Key Generation

19 Feb 2013 » Boneh Franklin IBC using the PBC library