-
January 6th, 2015, 10:50 PM
#1
Handling large exponents in Csharp
I have this line in an encryption software I'm trying to write:
enc = (ulong)((Math.Pow(raw, e)) % n);
However it seems it's not calculating correctly, probably because the exponents are too large.
For example, 65^17 % 3233 should yield 2790. However my program is giving me 887. What's the best way to simplify the exponent into a more manageable number?
-
January 8th, 2015, 12:07 PM
#2
Re: Handling large exponents in Csharp
I've seen code that handles 40 / 128 / 256 bit integers to implement encryption. The code includes routines that implement the maths on the huge integer types.
.Net framework has a cryptology model http://msdn.microsoft.com/en-us/libr...v=vs.110).aspx
If you want to implement yourself - look here first - http://www.efgh.com/software/rsa.htm Its c++ but will give you an idea of how to go about it....
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|