5.0

5.0 | 2 ratings Rate this file 2 Downloads (last 30 days) File Size: 353 Bytes File ID: #932

big x^y modulo function

by Michael Neve

 

15 Oct 2001 (Updated 16 Oct 2001)

provide the solution when the normal mod function can't because the input is to big

| Watch this File

File Information
Description

In some fields as cryptology (RAS-cryption), there is a need of doing x^y mod m where x, y and n are huge. The build-in maltab function can't achieve the result because it first calculate x^y and found it is equals to inf. The hereunder function provides a performent solution to this problem and gives the right answer...

Acknowledgements
This submission has inspired the following:
big modulo function
MATLAB release MATLAB 6.0 (R12)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (4)
03 Jun 2004 Muhammet UNAL

thank you! exactly what I need

08 May 2005 bennyboss n/a

many thanks! I must say the same, exactly what I need.

11 Nov 2007 Pavel Stepanek

thank you, that is the what I need. I am very surprised, that standard mod function in Matlab does not work well for me, even if input is relatively small, e.g. mod(8^51,103) produce
 1.267650600228229e+030 instead of 58. Has anybody idea, why it is so?

11 Nov 2007 Pavel Stepanek

Sorry, mod(8^51,103) should produce 1.

Please login to add a comment or rating.
Tag Activity for this File
Tag Applied By Date/Time
modulo Michael Neve 22 Oct 2008 06:38:35
exponentiation Michael Neve 22 Oct 2008 06:38:35
cryptology Michael Neve 22 Oct 2008 06:38:35
solution Michael Neve 22 Oct 2008 06:38:35

Contact us at files@mathworks.com