Search code examples
encryptionencodingcircuitdigital-logic

How do I encrypt a 4 bit number using multiple patterns?


I'll preface this by saying I Don't want the answer, just a nudge in the right direction.

The conversion table for the encryption is as follows:

Input --> Output

0 --> 15

1 --> 14

2 --> 13

3 --> 12

4 --> 0

5 --> 1

6 --> 2

7 --> 3

8 --> 7

9 --> 6

10 --> 5

11 --> 4

12 --> 8

13 --> 9

14 --> 10

15 --> 11

Here's what I've done so far. enter image description here

Essentially there are 2 patterns and I want to know how to implement them both in a single circuit. I'm completely stumped.


Solution

  • B2 is always negated. If B2 is not set, all other bits are negated.

    Seems like an easy enough condition to encode in a circuit.