Tagged: big integer Toggle Comment Threads | Keyboard Shortcuts

  • CG 8:59 pm on September 29, 2008 Permalink | Reply
    Tags: big integer,   

    How big? 

    After thinking for a while, what is the maximum big integer needed to represent a stream of characters? I mean, if I convert characters into a big number like I did in the previous posting, then I can only have 42 characters at maximum! O-ow, big problem!

    Have got to find another way  [thinking hard…]

    Advertisements
     
    • Budi Rahardjo 3:52 am on September 30, 2008 Permalink | Reply

      You can treat stream of characters as block of characters (say block of 42 characters). Then you can do the rest with your code.

      But I think there’s a better way to represent string (i.e. not just concatenate the ASCII values). Can you view them as series of bytes? This way, you can also code binary data (i.e. sequence of bytes) into big int. I am not sure whether this is efficient or not. though.

      Sorry if I am not clear. Hey, this is early in the morning and I am not awake yet. 🙂

    • chikaradirghsa 4:21 am on September 30, 2008 Permalink | Reply

      @BR: yes, exactly. it’s early in the morning and we’re still awake talking about representing characters! 😀

      agree, before reading your comment I have been thinking about dividing messages into message blocks and convert them into different points in the curve.

      i don’t understand the second paragraph. i’m treating the string as the series of bytes. explain please

    • Budi Rahardjo 9:15 am on September 30, 2008 Permalink | Reply

      In your example, CRYPTO, you convert it into a string “678289808479″. What if you convert that into sequence of bytes: 67, 82, 89, 80, 84, 74. Thus, just put them in the LSB in that order (or whatever order you choose). This way, 6 characters are turned into 6 bytes. But, you still have limitation (the number of bytes in big int). Anyway, it’s just an idea.

      The nicest thing about this is that you can read a binary file and read it into chunk of bytes. You are not limited to ASCII representation of the bytes.

      Again, I’ve seen a more efficient implementation. Basically, you want to put more bytes into the block/chunk. (Maybe base-64 or some sort? I have to read up on this. I am rusted!)

      Is it clear? Or more confusing? 😀

    • chikaradirghsa 6:55 pm on September 30, 2008 Permalink | Reply

      @BR: i have read about some string encoding/decoding like MIME base64, and I also found piece of code on that in CryptoLib, but they all just give me more headache 🙂

      i think for now i will just use the conversion in string of numbers, and do the complete cycle of encryption/decryption. then i’ll experiment with more text which will be converted to more than one points.
      then we’ll think about more efficient way to do that afterwards 😉

      how about that?

  • CG 8:28 pm on September 29, 2008 Permalink | Reply
    Tags: big integer, , ,   

    Characters to numbers 

    I’m experimenting with the way of converting a string into a big integer representation. And this is how I’m doing it:

    1. Convert each character to its ASCII number, then treat them as a sequence of numbers that becomes a big number. For example, if the text is “CRYPTO” then the number will be “678289808479”. This number then will be stored in a FIELD2N variable. [done]
    2. The number then calculated to check if it fits on the curve. If not, add 1 to the next byte outside the bytes used for storing data. Repeat until the value fits in. [to be done next]

    Here’s some result:

     
  • CG 8:23 pm on September 27, 2008 Permalink | Reply
    Tags: big integer,   

    Converting ASCII to BIGINT and vice versa 

    Reporting a little progress today, that I have successfully understood and made a code to convert ascii to bigint and vice versa.

    The structure for a big integer is as follows:

    typedef unsigned long ELEMENT;
    typedef struct {
        ELEMENT        hw[4*MAXLONG];
    }  BIGINT;

    MAXLONG is the number of machine words used in an array that holds NUMBITS. NUMBITS is the total number of bits we expect to be working with.

    I’m still using Rosing’s book for reference.

    Next step will be make more codes on big integer’s operations.

    Then what? Why am I doing this anyway?

    […recalling the last progress…]

    Oh – oh, I guess I was in the middle of trying to find a way on how to convert a big number into a point in elliptic curve… and then, I need to know how to represent a big big integer, and how to deal with it.

    Then?

    I guess it will be easier to continue working on the plaintext converting code.

    Ok, that’s it for now!

     
    • Budi Rahardjo 7:35 am on September 28, 2008 Permalink | Reply

      Trying to understand. Does big integer needed in elliptic curve? Meaning, everything is done in bigint. Is that it?

      How do you convert ASCII to bigint? Do you simply put the ASCII value in the LSB of the bigint? Can you extend that to unicode representation?

    • chikaradirghsa 6:53 pm on September 28, 2008 Permalink | Reply

      @BR: yes, big integer is needed in elliptic curve because the data and the point and the curve will be in big integer representation.

      the ASCII is treated as string, then converted to big integer. Ex: “12345” will be converted into 0x3039 and then (as you said) put in the LSB of the bigint.

      Do you think unicode representation will be much easier?

    • tetangga sebelah 7:36 pm on October 6, 2008 Permalink | Reply

      gila saking begonya saya…sampai egak tahu, kenapa ASCII ke Big-Integer jadi masalah.
      bukannya ASCII atau unicode itu integer?…..jadi itu kan hanya process widening.
      …..wah kayanya ini batas aku bisa nyuri ilmu……teu kataekan ahhhh

    • chikaradirghsa 8:50 pm on October 6, 2008 Permalink | Reply

      @tetangga sebelah: jelasin atuh process widening!

    • musloyals 7:49 pm on October 21, 2008 Permalink | Reply

c
Compose new post
j
Next post/Next comment
k
Previous post/Previous comment
r
Reply
e
Edit
o
Show/Hide comments
t
Go to top
l
Go to login
h
Show/Hide help
shift + esc
Cancel