How do I perform the inverse of a number to be applied in the encryption and decryption in multiplication encoding in MATHLAB? With GUI.
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
How do I perform the inverse of a number to be applied in the encryption and decryption in multiplication encoding in MATHLAB? With GUI.
0 Commenti
Risposte (1)
John D'Errico
il 9 Nov 2022
A gui is irrelevant. It is YOUR job to write a gui, if you need one.
You compute the inverse of a number by dividing it into 1. So 1/x is the inverse of x.
Perhaps you are asking about a modular multiplicative inverse. If so, then you can use GCD. Read the help for GCD.
help gcd
Does a multiplicative inverse for a number that is NOT relatively prime to the modulus? No. That is, 2 does not have a multiplicative inverse mod 6. There is no integer x such that mod(2*x,6)==1.
So a multiplicative inverse, of the form mod(a*x,B)==1, if a and b are relatively prime. If that is the case, then the gcd(a,b)==1. GCD will return that. But then look at the other outputs to GCD. GCD returns also C and D, such that
G = a*C + b*D
If we take that equation modulo b, then we see it reduces to
G = a*C
where we know that G == 1, since a and b were relatively prime. So now we have
mod(a*C,b) == 1
Therefore C is the multiplicative modular inverse of a in the ring of integers modulo b.
0 Commenti
Vedere anche
Categorie
Scopri di più su Resizing and Reshaping Matrices in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!