private void decrypt_Click(object sender, EventArgs e)
{
v = Convert.ToDouble (txtencrypt.Text);
t = Math.Pow(v, d);
msg = Convert.ToInt16(Math.Pow(v,d) % Convert.ToDouble(n));
txtdecrypt.Text = Convert.ToString(msg);
}
This is the code im doing for decryption in rsa algorithm but i got a problem in power operation.
For a small power value,the power operation performed well but when im using highest value as a power i got exponential value as a output.
csss 0 Newbie Poster
Recommended Answers
Jump to PostPlease explain what exactly are using v,n and d for. are they IV's and Keys ?
Did you know you can use .NET building Encryption and Decryption algorithms ?Hope …
Jump to PostPerhaps you could consider this.
Jump to PostGood idea ddanbe, this produces the results you want:
First you have to be targeting atleast Framework 4, which means VS 2010 or later, then you have to add a reference to
System.Numerics.dll
, then you have include itusing System.Numerics;
BigInteger v = 11; …
Jump to PostYou could implement your own biginteger class if you don't have one. Google.
Examples:
http://www.codeproject.com/Articles/2728/C-BigInteger-Class
http://www.boyet.com/Articles/PiCalculator.html
All 13 Replies
Mike Askew 131 Veteran Poster Featured Poster
mshauny 25 Junior Poster in Training
tinstaafl 1,176 Posting Maven
csss 0 Newbie Poster
Mike Askew 131 Veteran Poster Featured Poster
tinstaafl 1,176 Posting Maven
csss 0 Newbie Poster
csss 0 Newbie Poster
ddanbe 2,724 Professional Procrastinator Featured Poster
tinstaafl 1,176 Posting Maven
csss 0 Newbie Poster
ddanbe 2,724 Professional Procrastinator Featured Poster
TnTinMN 418 Practically a Master Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.