#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <stdlib.h>
#include <NTL/ZZ_p.h>

#define PORT 6996
ZZ VALUE=to_ZZ(5460);

static int buf[BUFSIZ];

int convert(ZZ_p x){
    ZZ_p i;
    int j;
    for(i=0,j=0;i!=x; i++,j++);
    return(j);
}


// the hash function
 ZZ hash(ZZ a, ZZ b, ZZ c)
 {
    ZZ k;
    b = b % to_ZZ(173);
    k = a * b + c;
    return k;
 }
             

ZZ changeMi(ZZ n, int index){
    ZZ Mi;
    Mi = n + to_ZZ(index+1) * VALUE;
    return(Mi);
}

ZZ change_backMi(ZZ Mi, int index){
    ZZ P;
    P = Mi - to_ZZ(index+1) * VALUE;
    return(P);
}



