This function realizes the hamming code of a 3 variables input. We use the specification from Maslovs et. al benchmark page. The function was originally proposed by Patel and Markov.