Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Big Integer Maths - C or Java?

  • 29-03-2008 4:08pm
    #1
    Closed Accounts Posts: 12,382 ✭✭✭✭


    I'm going to be coding an elliptic curve cryptography algorithm over the next few months. From what I gather, dealing with big integers will be a large part of this.

    Have any of you worked with big integers before?

    Would I be right to assume using Java with big integers is a lot more straight forward than using C?

    Any suggestions appreciated.

    Thanks.


Comments

  • Registered Users, Registered Users 2 Posts: 1,922 ✭✭✭fergalr


    Don't know a lot about this field.
    One thing that'll influence your choice is whether you want ease of implementation, or speed of execution?

    I have used Javas BigInteger during programming competition questions, and it was fine, the API did what it said on the tin, was discoverable, and broad enough for the limited use required.

    For C the GMP library is fast, and mature.
    It's also going to have a wider range of related useful functionality than the standard J2SE api will. It's actually made with crypto in mind as a use. On the other hand, will probably take a little longer to learn to use.
    I've only played with it a few times though, so can't say more than that.

    Edit: Thinking about it, I imagine if you're going to spend a while working on this, or similar cryptographic stuff, (and if matlab and similar aren't suitable) you're probably better off getting into C and GMP rather than trying to use Javas limited functionality...


  • Closed Accounts Posts: 12,382 ✭✭✭✭AARRRGH


    Thanks for the reply.

    I guess a balance of ease of use and functionality is what I need. I generally find Java a lot easier to read and program in than C, but I defo don't want to find out in a couple of months time that Java doesn't support some of the functions I need.

    Hmmmm.

    Maybe C is the safer option.


  • Registered Users, Registered Users 2 Posts: 1,922 ✭✭✭fergalr


    I guess a balance of ease of use and functionality is what I need. I generally find Java a lot easier to read and program in than C, but I defo don't want to find out in a couple of months time that Java doesn't support some of the functions I need.

    When you get used to C (as opposed to C++), it's actually a very clean and elegant language, especially when used for stuff like this. It's limited feature set makes it easy to read.

    I don't know the specifics of your project, but if the sole focus of the project is the implementation of the crypto algorithm (as opposed to, for example, any ancillary file i/o, ui, network requirements) then I imagine it'd be fairly quick to port to C at a later stage, if you wanted to.
    In other words, the maths dense code shouldn't look that much different in C than in Java, and you probably won't have a huge number of lines of code to convert anyway, as you'll be spending most of your time thinking about what exactly the maths should be, rather than writing code.

    Still, I'm guessing a lot, and know very little about the problem domain.
    Maybe someone else can answer your question better.


  • Closed Accounts Posts: 1,567 ✭✭✭Martyr


    MIRACL is used by good few people for ECC.

    MIRACL is a Big Number Library which implements all of the primitives necessary to design Big Number Cryptography into your real-world application. It is primarily a tool for cryptographic system implementors. RSA public key cryptography, Diffie-Hellman Key exchange, DSA digital signature, they are all just a few procedure calls away. Support is also included for even more esoteric Elliptic Curves and Lucas function based schemes. The latest version offers full support for Elliptic Curve Cryptography over GF(p) and GF(2m) - see the links on this page for more details.

    LIDIA is also worth checking, but i'd say MIRACL is the best.

    try get your hands on pdf of book Guide to Elliptic Curve Cryptography


  • Closed Accounts Posts: 12,382 ✭✭✭✭AARRRGH


    Thanks Average Joe.

    I have that book :) At the moment it's a bit too advanced for me, but I reckon it'll come in handy in a few weeks/months time.

    I'll check out MIRACL. Cheers.


  • Advertisement
  • Closed Accounts Posts: 1,567 ✭✭✭Martyr


    no problem.
    there is an ECDSA example in the MIRACL sources which is good example of how signature schemes are used for registration in software products.


Advertisement