private void decrypt_Click(object sender, EventArgs e)
        {
            v = Convert.ToDouble (txtencrypt.Text);
            t = Math.Pow(v, d);

            MessageBox.Show(Convert.ToString(t));
            MessageBox.Show(""+t.ToString());
            MessageBox.Show("" + Convert.ToDecimal(n));
            msg = Convert.ToInt16(Math.Pow(v,d) % Convert.ToDouble(n));
            txtdecrypt.Text = Convert.ToString(msg);

        }

this is the code im working now for rsa decryption. the problem im getting is the pow function
return in exponential format, but i need the non exponential format of output.
can any one please help me to find out solution?

Recommended Answers

All 5 Replies

The Format function should do the trick. Here's the MSDN article

You can use the double.ToString(string format) to specify the way a double is formatted. See Standard Numeric Format Strings and Custom Numeric Format Strings. For example, 1e64 with the "custom" format string 0 returns the string 10000000000000000000000000000000000000000000000000000000000000000. This example doesn't account for decimal digits, but you could use the standard f format specifier, if you have an idea of how many digits you need.

If you're running into issues with decimal digits (eg. 0.000000000000000002929), then you'll want to have a look at this thread.

I want actual value when perform power operation
ex:11pow23=895430243255237372246531
but i got 895430243255237000000000 value when i perform power operation after convert into decimal.
please help me.

A double has a precision of 15-16 digits. Look up the article in say MSDN.

Perhaps this is what you really need.

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.