1
$\begingroup$

my teacher asked the class to do a digial circuit that encrypted a message using cesar's cipher, and a circuit to decrypt, but my only idea is to solve it using a circuit that does P + K mod N, where P is The position of the letter in the alphabet, K the value of the key, and N is the number of letters in the alphabet. Or use an adder circuit, for example, when P and K have 4 bits, and N equals 8. Even if an overflow occurs, the sum between them would still give me a result within my representation. However, in my case I am using an alphabet with 94 symbols, so how can I solve this problem?

I appreciate any help.

$\endgroup$

closed as off-topic by David Richerby, Evil, hengxin, Juho, fade2black Aug 9 '17 at 22:35

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question does not appear to be about computer science, within the scope defined in the help center." – David Richerby, Evil, hengxin, Juho, fade2black
If this question can be reworded to fit the rules in the help center, please edit the question.

  • $\begingroup$ This is essentially "how do I write this program?" question, except with digital circuits rather than a programming language. Sorry, but this kind of question is off-topic. I'm not sure if it would be on-topic at Electrical Engineering (which covers electronics, too) -- check their help centre. $\endgroup$ – David Richerby Jul 11 '17 at 11:55
1
$\begingroup$

You can instead subtract $N-K$ and test if you go negative and then add $N$ again. Or test the number against $N/2$ and if greater subtract $N-K$ otherwise add $K$.

With 94 symbols you only need 7 bits. If you go with the post check you'll need to add a bit to account for overflows for certain values of input and $K$.

$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.