Last active
June 11, 2019 13:43
-
-
Save vinloo/8da9fa31d880a452f4723748b49c15ce to your computer and use it in GitHub Desktop.
Find decryption function of lineair encryption function
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ClrHome | |
| Disp "E(x) = ax + b in Z(m)" | |
| Input "m = ",M | |
| Input "a = ",A | |
| Input "b = ",B | |
| ClrHome | |
| Output(1,1,"E(x) = "+toString(A)+"x + "+toString(B)+" in Z("+toString(M)+")") | |
| Output(4,1,"Calculating...") | |
| remainder(A,M)→H | |
| For(I,1,M) | |
| If remainder((H*I),M)=1 | |
| Then | |
| I→P | |
| Goto 1 | |
| End | |
| End | |
| Lbl 1 | |
| ClrHome | |
| M-P*B→Q | |
| Output(1,1,"E(x) = "+toString(A)+"x + "+toString(B)+" in Z("+toString(M)+")") | |
| If B=0 | |
| Then | |
| Output(4,1,"D(y) = "+toString(P)+"y MOD "+toString(Q)) | |
| Else | |
| Output(4,1,"D(y) = "+toString(P)+"y + "+toString(Q)+" MOD "+toString(M)) | |
| End | |
| For(I,1,6) | |
| Disp "" | |
| End | |
| Pause "Press enter to exit" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
