Solve for two variables within to linear modulus equations
Show older comments
I am currently working on a project to break a text file encoded with the Affine Cipher using unknown keys. The text file contains the extended ASCII so my modulus will be 256 (given in project instructions).
I am trying to avoid brute forcing this, and I will like algebraically solve for my key using frequency analysis of the cipher text. The problem I am running into is I am not super familiar with Matlab, but it is what we use in the course.
So this is what I have tried, using a known key of (251,69)
S = solve(32*a+b==165, 101*a+b==76)
S.a = -89/69
S.b = 14233/69
What I would like to some how do is this:
S = solve(mod(32*a+b,256)==165, mod(101*a+b,256)==76)
S.a = 251
S.b = 69
However, this does not work. I've searched and attempt MuPAD and the lincongruence, but it does not seem appropriate for two variables. I've also tried linsolve and setting the Domain = Dom::IntegerMod(256). But that threw the following error:
Error: 'Domain = R', where R is a domain of category 'Cat::Field', expected. [linsolve]
Thank you in advance!
(Using Matlab R2018b Academic Use)
Accepted Answer
More Answers (0)
Categories
Find more on Operating on Diagonal Matrices in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!