Homomorphic Encryption for Gray Codes

Prof Bill Buchanan OBE FRSE
4 min readSep 18, 2024

When I studied electronic engineering, there was one code that was so simple to implement but could minimise the number of changes that we have in a circuit: the Gray Code.

For the Gray code, we make sure there is only one bit change for an incremental count. Thus for our binary code, if we go from 1 (0001) to 2 (0010), there is be two transistions of bits. But with a Gray code we can represent 1 by 0001 and 2 by 0011, and so there is only one transition of the bits. The truth table is then:

Decimal       Binary     Gray
----------------------------
0 0000 0000
1 0001 0001
2 0010 0011
3 0011 0010
4 0100 0110
5 0101 0111
6 0110 0101
7 0111 0100
8 1000 1100
9 1001 1101
10 1010 1111
11 1011 1110
12 1100 1010
13 1101 1011
14 1110 1001
15 1111 1000

The circuit for this is then:

Now, let’s implement this with homomorphic encryption. Overall, FHEW [1] uses a LWE (Learning With Error) method that provides fully homomorphic…

--

--

Prof Bill Buchanan OBE FRSE

Professor of Cryptography. Serial innovator. Believer in fairness, justice & freedom. Based in Edinburgh. Old World Breaker. New World Creator. Building trust.