This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

1024 bit Arithmetic using 8, 16, 32 bit microcontroller

Please tell me how to achieve 1024 bit and above Arithmetic operation using 8, 16, 32 bit microcontroller.
The Arithmetic operation consist of Addition, Subtraction, Multiplication, Division, Modulo.

Parents
  • Please tell me why on earth you would want to do 1024-bit arithmetic on an 8-bit microcontroller??!

    Please also telly me why you think the techniques would differ depending on the word size of the arbitrary, unspecified microcontrollers?

Reply
  • Please tell me why on earth you would want to do 1024-bit arithmetic on an 8-bit microcontroller??!

    Please also telly me why you think the techniques would differ depending on the word size of the arbitrary, unspecified microcontrollers?

Children
  • 1024 bit arithmetic is used in RSA and other crtyptography algorithms.

    RSA is a public-key algorithm and uses so big numbers just to make it hard to factor the product of two very big primes and get back the primes.

    Anyway - it is really trivial to implement arbitrary precision arithmetic just as long as the processor has enough RAM to store the numbers and any intermediary results.

  • "Please tell me why on earth you would want to do 1024-bit arithmetic on an 8-bit microcontroller??!"

    please tell me why on earth a "computer programmer" failed to see the need to do higher-bit arithmetic on a lower-bit microcontroller??!

  • Maybe because Andy knows how to read and noticed that the OP specified the ARM toolset. The ARM processors are 32-bit, so why is the question mentioning 8-bit and 16-bit processors?

  • i need 1024 bit arithmatic to implement RSA public key encryption technique in my system.
    With RSA public key encryption technique any raw data is converted into N bit of encrypted data.
    N is bit size of the key.
    it can vary depending on the security require in any application.
    in our application we want to implement 1024 bit RSA encryption technique.

    as we can able to declare long (32 bit) or longlong (64 bit) variable in the keil compiler.
    with those variable i can able implement max32 bit or 64 bit RSA encryption technique.
    To achieve 1024 bit RSA encryption i need to write some special routine.

    I AM LOOKING FOR THOSE SPECIAL ROUTINE.

    I think link provided by Mike Kleshov will solve my requirement.
    I will go through it and will come back for any query.

  • Not just any "higher"-bit arithmetic on any "lower"-bit microcontroller - but why specifically 1024-bit aithmetic on an 8-bit micrcontroller?

    A single 1024-bit value is 128 bytes - that is the entire DATA space of an 8051!

    It really doesn't sound like a sensible thing to be doing on an 8-bit processor!

  • I want 1024 bit algorithm for diffrent controller like 32 bit ARM controller, 16 bit c166 controller, 8 bit higher end controller like renesas, etc where RAM size is of 2 KB.

    i need to write a flexible code which will support RSA encryption technique with variable key length. ( 32 bit to 1024 bit)

  • "i need to write a flexible code which will support RSA encryption technique with variable key length. ( 32 bit to 1024 bit)"
    There are no such thing as any 32-bit RSA. You need ridiculously large keys to get any security. A 32-bit or 64-bit key would be cracked in almost no time. 1024 is already questionably small and the recommendation is 2048 bits or more.

    Anyway - as long as the processor has RAM enough, the algorithms will just contain loops to perform the calculations with an arbitrary number of bits. There are many big number libraries available, and it is also quite easy to implement your own code for the few operators you need.

    Note that you should also pad the data, to reduce the probability of some specific attacks being able to quickly crack even quite large key sizes.

  • Another important point: when designing your own cryprographic system, you have to know exactly what you are doing. It is too easy to leave a hole which will compromise the overall security, and no amount of bits in the keys used will help that.

  • "It really doesn't sound like a sensible thing to be doing on an 8-bit processor!"

    it really doesn't sound like a sensible thing to be saying for any "computer programmer".

  • "It is too easy to leave a hole which will compromise the overall security, and no amount of bits in the keys used will help that."

    Such errors happens regularly even when the people involved do know what they are doing.

    And as Andy notes, I would stay away from 8-bit or 16-bit processors if there is a need for decent cryptographic security.

    I don't think I would go for any processor that can't run the OpenSSL code. Note that OpenSSL can be configured, so there is no need to include all algorithms.

    There may be security holes in the OpenSSL package, but no home developer or "normal" company can hope to match OpenSSL when it comes to code quality or amount of security reviews.

  • Flexible means i will keep provision in the design to generate variable length of RSA encryption.
    To end customer, i will give fix bit (which is from 32 to 1024) encryption which practicle feasible depending on the complete hardware of the system.

    i came across one white paper for 1024 RSA on 8 bit Microcontroller as below mentioned address.
    www.research.sun.com/.../crypto

    As mentioned in the paper the author implemented various method like row wise multiplication, column wise multiplication, hybrid multiplication.

    If some able to through more light on those technique , then it will be more helpfull.

  • I don't know about any encryption algorithm that is safe at only 32 bits.

    And if you did mean RSA, the page
    en.wikipedia.org/.../RSA
    notes that 300-bit RSA can be cracked within a couple of hours with a single PC.

    Anything less than 1024 bits is a joke, and you would like to use 2048 bits to have a bit of safety margin.

    If you let your customers select a RSA size between 32 and 1024 bits, then the customers will look at you and then they will turn their back and walk away.

    The trick here is that RSA is too slow for encrypting real data. So you only use RSA for negotiating and transmitting a crypto key for a symmetric chiffer. Then you switch to something more efficient. But it doesn't matter how efficient or safe that second chiffer is, if you do the key negotiation with so weak encryption that people can break it with standard software you can download from the net.

    If the hardware can't handle secure key sizes for RSA, then you only have two options. Find another processor or find another algorithm. Stepping down to ridiculous key sizes is not an option. You will only fool yourself and the customer into believing that you have a safe system. Customers don't like to be fooled! Customers may even decide to sue you if they feel that you have intentionally misinformed them, or shown grave unprofessionalism. If you can't do 1024-bit RSA - don't bother.

  • If a "computer programmer" is someone concerned only with the beauty of the source code, and not the implications on the underlying architecture, then I suppose they would not be talking about such trifling details...