473,698 Members | 2,588 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

BigInteger.prob ablePrime in C#.Net???

Hi,

Im developing RSA cryptography based application in VC#.Net 2.0 and
need to use "BigInteger.pro bablePrime()". I know that VC#.Net 2.0
doesn't have the BigInteger class but found that one buddy created
BigInteger class but it is missing some overloading function like
BigInteger.prob ablePrime(). The code of the BigInteger class developed
in the C#.Net can be found here:
http://www.codeproject.com/KB/cs/biginteger.aspx

Quick suggestions are always welcome.
Thanks in advance.
Jul 10 '08 #1
11 10505
On Jul 10, 2:10*pm, imranisb <imran...@gmail .comwrote:
Hi,

Im developing RSA cryptography based application in VC#.Net 2.0 and
need to use "BigInteger.pro bablePrime()". I know that VC#.Net 2.0
doesn't have the BigInteger class but found that one buddy created
BigInteger class but it is missing some overloading function like
BigInteger.prob ablePrime(). The code of the BigInteger class developed
in the C#.Net can be found here:http://www.codeproject.com/KB/cs/biginteger.aspx
What, exactly, should such a method do?
Jul 10 '08 #2
If you mean the Java BigInteger class and method by that name, then I think
the easiest thing is just wrap that method in a java console app and run it
from c#. I suspect implimenting that method in c# is fairly involved...

"imranisb" wrote:
Hi,

Im developing RSA cryptography based application in VC#.Net 2.0 and
need to use "BigInteger.pro bablePrime()". I know that VC#.Net 2.0
doesn't have the BigInteger class but found that one buddy created
BigInteger class but it is missing some overloading function like
BigInteger.prob ablePrime(). The code of the BigInteger class developed
in the C#.Net can be found here:
http://www.codeproject.com/KB/cs/biginteger.aspx

Quick suggestions are always welcome.
Thanks in advance.
Jul 10 '08 #3
I wrote a C# interface to GNU GMP (big Number) project. It includes an
interface to "isPrime", which does the probablistic Miller/Rabin test. You
can find it at http://sites.google.com/site/fredm/H...terface-to-gmp.
It uses C++ (dotNet) to make the classes which are then accessible via C#.

If you don't want to use that, I can supply native C# code that does the
test; it uses C# native type (ulong, which is 64 bits -- might not be "big"
enough for your purposes). That code is only about 80 lines long.

If you want to write your own function, look up Miller-Rabin on the net to
see how it works.
"imranisb" <im******@gmail .comwrote in message
news:17******** *************** ***********@59g 2000hsb.googleg roups.com...
Hi,

Im developing RSA cryptography based application in VC#.Net 2.0 and
need to use "BigInteger.pro bablePrime()". I know that VC#.Net 2.0
doesn't have the BigInteger class but found that one buddy created
BigInteger class but it is missing some overloading function like
BigInteger.prob ablePrime(). The code of the BigInteger class developed
in the C#.Net can be found here:
http://www.codeproject.com/KB/cs/biginteger.aspx

Quick suggestions are always welcome.
Thanks in advance.

Jul 10 '08 #4
Pavel Minaev wrote:
On Jul 10, 2:10 pm, imranisb <imran...@gmail .comwrote:
>Im developing RSA cryptography based application in VC#.Net 2.0 and
need to use "BigInteger.pro bablePrime()". I know that VC#.Net 2.0
doesn't have the BigInteger class but found that one buddy created
BigInteger class but it is missing some overloading function like
BigInteger.pro bablePrime(). The code of the BigInteger class developed
in the C#.Net can be found here:http://www.codeproject.com/KB/cs/biginteger.aspx

What, exactly, should such a method do?
http://java.sun.com/javase/6/docs/ap...bablePrime(int)

would be a good guess.

Arne
Jul 10 '08 #5
Family Tree Mike wrote:
If you mean the Java BigInteger class and method by that name, then I think
the easiest thing is just wrap that method in a java console app and run it
from c#. I suspect implimenting that method in c# is fairly involved...
The easiest would be to do:

using System;

using java.math;

namespace E
{
public class Program
{
public static void Main(string[] args)
{
BigInteger bi = new BigInteger("123 45");
Console.WriteLi ne(bi.isProbabl ePrime(10));
}
}
}

since BigInteger was part of Java 1.1 and therefore exist
in J#.

There is just one problem: the implementation !

It is horrible slow.

Arne
Jul 10 '08 #6
But that isn't available in VS 2008, is it?

"Arne Vajhøj" <ar**@vajhoej.d kwrote in message
news:48******** *************** @news.sunsite.d k...
Family Tree Mike wrote:
>If you mean the Java BigInteger class and method by that name, then I
think the easiest thing is just wrap that method in a java console app
and run it from c#. I suspect implimenting that method in c# is fairly
involved...

The easiest would be to do:

using System;

using java.math;

namespace E
{
public class Program
{
public static void Main(string[] args)
{
BigInteger bi = new BigInteger("123 45");
Console.WriteLi ne(bi.isProbabl ePrime(10));
}
}
}

since BigInteger was part of Java 1.1 and therefore exist
in J#.

There is just one problem: the implementation !

It is horrible slow.

Arne

Jul 11 '08 #7
Family Tree Mike wrote:
"Arne Vajhøj" <ar**@vajhoej.d kwrote in message
news:48******** *************** @news.sunsite.d k...
>Family Tree Mike wrote:
>>If you mean the Java BigInteger class and method by that name, then I
think the easiest thing is just wrap that method in a java console
app and run it from c#. I suspect implimenting that method in c# is
fairly involved...

The easiest would be to do:

using System;

using java.math;

namespace E
{
public class Program
{
public static void Main(string[] args)
{
BigInteger bi = new BigInteger("123 45");
Console.WriteLi ne(bi.isProbabl ePrime(10));
}
}
}

since BigInteger was part of Java 1.1 and therefore exist
in J#.

There is just one problem: the implementation !

It is horrible slow.
But that isn't available in VS 2008, is it?
VS 2008 comes with .NET 3.5, .NET 3.5 uses .NET 2.0 CLR, J# runtime
is available for .NET 2.0.

Why should it not be possible to make a ref to vjslib.dll in VS 2008 ?

Arne
Jul 11 '08 #8
On Thu, 10 Jul 2008 03:10:50 -0700 (PDT), imranisb
<im******@gmail .comwrote:
>Hi,

Im developing RSA cryptography based application in VC#.Net 2.0 and
need to use "BigInteger.pro bablePrime()". I know that VC#.Net 2.0
doesn't have the BigInteger class but found that one buddy created
BigInteger class but it is missing some overloading function like
BigInteger.pro bablePrime(). The code of the BigInteger class developed
in the C#.Net can be found here:
http://www.codeproject.com/KB/cs/biginteger.aspx

Quick suggestions are always welcome.
Thanks in advance.
If you have, or can obtain, a copy of "Practical Cryptography" by
Ferguson and Schneier they give an algorithm in section 11.4

The algorithm is basically very simple:

repeat
pick a random BigInteger in the right range
until (the number you picked is prime)

For reasonably sized numbers you will need a probabilistic prime text,
such as Miller-Rabin and some sort of level of confidence parameter so
you can be sure that your number is prime to better than say 1 in
2^128

Alternatively have a look at the Java source code for ideas, you can
download the Java source from Sun.

rossum

Jul 11 '08 #9
I cannot find such a dll on my system. I'm running VS 2008 pro. I found a
link that says it needs to be separately installed from this link:
http://msdn.microsoft.com/en-us/vjsharp/bb188598.aspx. It isn't clear to me
what version you need to target. In other words, would you need to target
2.0 and lose LINQ to get this?

"Arne Vajhøj" <ar**@vajhoej.d kwrote in message
news:48******** *************** @news.sunsite.d k...
Family Tree Mike wrote:
>"Arne Vajhøj" <ar**@vajhoej.d kwrote in message
news:48******* *************** *@news.sunsite. dk...
>>Family Tree Mike wrote:
If you mean the Java BigInteger class and method by that name, then I
think the easiest thing is just wrap that method in a java console app
and run it from c#. I suspect implimenting that method in c# is fairly
involved.. .

The easiest would be to do:

using System;

using java.math;

namespace E
{
public class Program
{
public static void Main(string[] args)
{
BigInteger bi = new BigInteger("123 45");
Console.WriteLi ne(bi.isProbabl ePrime(10));
}
}
}

since BigInteger was part of Java 1.1 and therefore exist
in J#.

There is just one problem: the implementation !

It is horrible slow.
But that isn't available in VS 2008, is it?

VS 2008 comes with .NET 3.5, .NET 3.5 uses .NET 2.0 CLR, J# runtime
is available for .NET 2.0.

Why should it not be possible to make a ref to vjslib.dll in VS 2008 ?

Arne
Jul 11 '08 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
12978
by: Jerry | last post by:
Hi, I am writing a Java Chatroom application that will implement encryption of messages using the RSA algorithm using the BigInteger class. It uses socket connections to exchange messages. I have managed to generated the Private and Public keys and exchanged public keys and modulus between the clients and server. Please could someone advise me how encrypt a short message, pass the encrypted message across a socket connection and then...
0
1729
by: Krzysztof Adamski | last post by:
Hi, Is it possible in jython to map an PyLong object to other class than BigInteger (i.e. java.lang.Long) ? Thanks for you help, Krzysztof Adamski
4
6394
by: adrin | last post by:
I have to create a c++ class similar to BigInteger from java... but i have no idea, how can i implement big numbers at all(mabye store every digit in list element? :)) how is it properly done? thanks for help
8
2076
by: Nafai | last post by:
Hello I would like you guys to give me the best solution for this problem: class bigInteger { private: vector<char> digits; public: ... bigInteger& operator+=(const bigInteger& x)
0
1443
by: hitler123 | last post by:
can anyone say me how to define BigInteger as a datatype in an xsd. this xsd i am uising in the xmlbeans.
19
6457
by: shana07 | last post by:
I don't understand about this program is doing. Could someone please tell me what it is about. Because I have gcd function in one program that calls this function. Thanks a lot switch (opcode) { case GCD: out = b1.gcd(b2).toString(); break; /** * Returns a BigInteger whose value is the greatest common divisor of * <tt>abs(this)</tt> and <tt>abs(val)</tt>. Returns 0 if * <tt>this==0 &amp;&amp;...
2
2843
by: gemacjr1201 | last post by:
I am creating a GUI for class and need help with my program. My program takes 2 big integers and adds them together. First how do I declare my 2 Big Integers and then add them together? I have read the API docs , but still need help. Thanks! import java.math.BigInteger; public class Integer { private BigInteger IntegerONE; // both entered as strings from GUI private BigInteger IntegerTWO; public Integer() {
2
2777
by: jehugaleahsa | last post by:
Hello: I am currently working on a some simple (not really) classes called BigInteger and BigRational. They are pretty much identical to Java's BigInteger and BigDecimal classes, respectfully. BigRational is really simple and it just maintains a dividend and denominator and then prints out the decimal form when done with the calculation.
6
13564
by: mearvk | last post by:
Does C++ or C have something roughly equivalent to this: http://java.sun.com/javase/6/docs/api/java/math/BigInteger.html What I need is a way to quickly convert between decimal and binary and from char*/string to a numeric representation. Thanks!
0
8680
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8609
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9030
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8871
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7738
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6528
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5861
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
3052
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2007
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.