Updates from March, 2013 Toggle Comment Threads | Keyboard Shortcuts

  • CG 9:17 pm on March 30, 2013 Permalink | Reply
    Tags: arithmetic, , , reduction,   

    Polynomial Basis Squaring 

    Finally have successfully found some spare time to do coding to solve this polynomial squaring:

    OLYMPUS DIGITAL CAMERA

    And this is the result, x^5 + x + 1 :

    Screen shot 2013-03-30 at 8.58.52 PM

     
    • rudi 9:37 pm on May 30, 2013 Permalink | Reply

      bu, akan lebih cantik kalo nulis polinomnya pake latex,
      x^5 + x+1

      • CG 11:00 am on May 31, 2013 Permalink | Reply

        iya belum sempet dirapihin 😀 biasanya saya pake latex for wordpress

    • Akshay 11:18 pm on July 26, 2013 Permalink | Reply

      Hey please mail me this complete C code. sorry I’m not execute this ….please help me…please ..

  • CG 2:01 pm on September 16, 2011 Permalink | Reply
    Tags: , random data,   

    Is this random enough? 

     
  • CG 3:18 pm on July 13, 2011 Permalink | Reply
    Tags: , ,   

    Setting up curves with different numbits for ElGamal 

    This book and the software is very useful for doing experiments of encrypting using elliptic curve cryptography. I’ve been reading some thread with questions on how to change curve parameters, and here’s how:

    To change the number of bits, you have to set it in field2n.h

    Choose the polynomial irreducible in polymain.c

    Set the message to be encrypted in elgamal.c (important note: the length of the message depends on the numbits of the curve)

     
  • CG 3:38 pm on January 20, 2011 Permalink | Reply  

    Polynomial reducer 

    ok. my algorithm works.

     
  • CG 9:10 pm on January 19, 2011 Permalink | Reply
    Tags: , classic multiplier, , ,   

    299 classic multiplier 

    … took forever to compile, and does not fit.

    the super long code generated using perl. with the help of master shifu, thank you 🙂

     
  • CG 3:39 pm on October 12, 2010 Permalink | Reply
    Tags: , , , , mac os x,   

    Compiling assembly on Snow Leopard 

    Comparing the compiling result with compiling assembly with Leopard (Mac OS X 10.5)

    code in c

    int logical(int x, int y){
       int t1 = x^y;
       int t2 = t1 >> 17;
       int mask = (1<<13)-7;
       int rval = t2 & mask;
       return rval;
    }
    

    gcc -S logical.c

    gcc -O1 -S logical.c

    gcc -O2 -S logical.c

    dumping object file
    gcc -c logical.c
    otool -tv logical.o

     
  • CG 5:55 pm on April 17, 2010 Permalink | Reply
    Tags: , pointer,   

    Pointers are so cruel… 

    They’re bad! And mean!

    After weeks of debugging, and still cannot get the plaintext back, now I’m moving to the next: building ECC on composite fields.

    Note: below is the result of the codes with printf-s everywhere. With the help of this debugger.

    The algorithm seems correct but the data recovered looks weird.


    poly_prime =
    8 0 0 0 0 c9
    setting up curves

    the curve after setting up:
    form: 1
    a2: 0 0 0 0 0 2
    a6: 0 0 0 0 0 1

    counter = 0
    inc = 5
    Base point
    x: 5 63323eab 10fc68f8 254d4d11 d2d518f2 9979dd24
    y: 4 883e6269 de8bf93e f6c224e3 330dbf7f 2dd25ec1

    create side 2's private key

    Side 2 secret:
    5 5d0be8bb a913fcdb 91edee60 4da6d486 295d85ac

    Generate side 2's public key

    Side 2 public key
    x: 1d5ba6c2 5378466 ae5d1cce 48770132 e9d6d710 a7448cd1
    y: 4 85500816 ccee8906 56a133dc 19c325f8 4bb9ffa6
    data =
    68616c6c 6f0a0000 0 0 0 60000000

    Hide data on curve and send from side 1 to side 2

    curve before send_elgamal:
    form: 1
    a2: 0 0 0 0 0 2
    a6: 0 0 0 0 0 1

    Their_public before send_elgamal:
    x: 1d5ba6c2 5378466 ae5d1cce 48770132 e9d6d710 a7448cd1
    y: 4 85500816 ccee8906 56a133dc 19c325f8 4bb9ffa6
    =====IN send_elgamal=====
    data (in send_gamal function) :
    68616c6c 6f0a0000 0 0 0 60000000
    Base point
    x: 5 63323eab 10fc68f8 254d4d11 d2d518f2 9979dd24
    y: 4 883e6269 de8bf93e f6c224e3 330dbf7f 2dd25ec1
    Base curve
    form: 1
    a2: 0 0 0 0 0 2
    a6: 0 0 0 0 0 1

    random value:
    5 3a0f94f6 e0caf9a7 2d189f04 8591c5e5 3935d4dc
    Random point C1
    x: 2 d6670f0 ab08aca3 8818adbe cf36881d 83accc06
    y: 2 cad560f5 72c889b5 226934a2 733455c8 c53a15a6
    counter = 0
    inc = 0
    counter = 0
    -- pnt->x =
    x: bffff4b8 a00754ec bffff4d8 a0073a58 a a
    y: 68616c6d 6f0a0000 0 0 0 60000000
    raw point M (after poly_embed)
    x: 68616c6d 6f0a0000 0 0 0 60000000
    y: 1 2c310f6b e4c3751c 2ef637ef ce837cb2 88e21c99
    Their_public:
    x: 1d5ba6c2 5378466 ae5d1cce 48770132 e9d6d710 a7448cd1
    y: 4 85500816 ccee8906 56a133dc 19c325f8 4bb9ffa6
    hidden point (after poly_elptic_mul)
    x: 6 987b3fe3 f486168f 19bba08c b943f599 c43cfa22
    y: 1 6a16b493 afad94b4 f93c6f41 40281e42 8c448f24
    Hidden data (C2):
    x: 68616c6c d3ba4b92 8c4b46c0 a6c78778 afcaf788 5187c979
    y: 68616c69 372ef71c 96586e6d bad28a2 ff127133 b48ca3de
    Random point (C1):
    x: 2 d6670f0 ab08aca3 8818adbe cf36881d 83accc06
    y: 2 cad560f5 72c889b5 226934a2 733455c8 c53a15a6
    =====OUT send_elgamal

    AFTER send_elgamal
    curve after send_elgamal:
    form: 1
    a2: 0 0 0 0 0 2
    a6: 0 0 0 0 0 1

    Hidden data (C2)
    x: 68616c6c d3ba4b92 8c4b46c0 a6c78778 afcaf788 5187c979
    y: 68616c69 372ef71c 96586e6d bad28a2 ff127133 b48ca3de
    Random point (C1)
    x: 2 d6670f0 ab08aca3 8818adbe cf36881d 83accc06
    y: 2 cad560f5 72c889b5 226934a2 733455c8 c53a15a6

    Recover transmitted message

    IN receive_elgamal
    Base curve in receive_elgamal
    form: 1
    a2: 0 0 0 0 0 2
    a6: 0 0 0 0 0 1

    Hidden_data (in receive_elgamal) :
    x: 68616c6c d3ba4b92 8c4b46c0 a6c78778 afcaf788 5187c979
    y: 68616c69 372ef71c 96586e6d bad28a2 ff127133 b48ca3de
    Random point
    x: 2 d6670f0 ab08aca3 8818adbe cf36881d 83accc06
    y: 2 cad560f5 72c889b5 226934a2 733455c8 c53a15a6
    hidden_point (d*C1):
    x: 7 1f5fceb7 8269106c c1708600 cde8821b 38e0c7ee
    y: 2 d752fec4 40840001 be4a3e7f 347e7013 7f36ce97
    &raw_point:
    x: 68616c6a de301be6 24719966 c269b54f ef049a08 8c7af389
    y: 3 fae10821 85e832bb b9c6d8ab cc4439f4 eb7441ea
    raw_point.x
    68616c6a de301be6 24719966 c269b54f ef049a08 8c7af389
    &raw_data (point):
    x: bffff670 10700ccf af82abf6 b46a9779 16316b62 7df7f7d
    y: 4037177 debca93c 4b16e65 77a8ff5a 70c28f88 1d5ba6c1
    raw_data (point):
    x: 68616c6a de301be6 24719966 c269b54f ef049a08 8c7af389
    y: 68616c6c 6f0a0000 0 0 0 60000000
    &raw_data (field):
    bffff670 10700ccf af82abf6 b46a9779 16316b62 7df7f7d
    raw_data (field):
    68616c6a de301be6 24719966 c269b54f ef049a08 8c7af389
    =====OUT receive elgamal

    sent data
    68616c6c 6f0a0000 0 0 0 60000000
    received data (point)
    x: 68616c6a de301be6 24719966 c269b54f ef049a08 8c7af389
    y: 68616c6c 6f0a0000 0 0 0 60000000
    received data (field)
    68616c6a de301be6 24719966 c269b54f ef049a08 8c7af389

     
    • Budi Rahardjo 7:11 pm on April 17, 2010 Permalink | Reply

      masih belum selesai debuggingnya. kayaknya mau ngerapihin code-nya dulu

      • CG 8:15 pm on April 17, 2010 Permalink | Reply

        be careful. the pointers like to behave unexpectedly anytime we alter the code. bad pointers! grrrrrr!!!

  • CG 5:05 am on September 14, 2008 Permalink | Reply
    Tags: , ,   

    Class hierarchies in Crypto Lib 

    Have been exploring the Crypto Library and deal with hundreds of header files I don’t even know yet how to use. Need to understand the class hierarchies (another OOP 😉 ), like this:

    // pubkey.h - written and placed in the public domain by Wei Dai
    
    #ifndef CRYPTOPP_PUBKEY_H
    #define CRYPTOPP_PUBKEY_H
    
    /** \file
    
        This file contains helper classes/functions for implementing public key algorithms.
    
        The class hierarchies in this .h file tend to look like this:
    <pre>
                      x1
                     / \
                    y1  z1
                     |  |
                x2<y1>  x2<z1>
                     |  |
                    y2  z2
                     |  |
                x3<y2>  x3<z2>
                     |  |
                    y3  z3
    </pre>
        - x1, y1, z1 are abstract interface classes defined in cryptlib.h
        - x2, y2, z2 are implementations of the interfaces using "abstract policies", which
          are pure virtual functions that should return interfaces to interchangeable algorithms.
          These classes have "Base" suffixes.
        - x3, y3, z3 hold actual algorithms and implement those virtual functions.
          These classes have "Impl" suffixes.
    
        The "TF_" prefix means an implementation using trapdoor functions on integers.
        The "DL_" prefix means an implementation using group operations (in groups where discrete log is hard).
    */
     
  • CG 5:35 am on August 1, 2008 Permalink | Reply
    Tags: , ,   

    Advanced vs Beginner 

    Well, seems like I picked the right supervisor/advisor. He’s still a good programmer! Here’s what we did yesterday. Oh, it was fun learning from the expert!

     
    • soni 8:19 pm on August 1, 2008 Permalink | Reply

      i am the expert too,
      in making trouble, gyahahahaha.

      do you like to learn something from me?

    • chikaradirghsa 8:34 pm on August 1, 2008 Permalink | Reply

      @soni: too bad. i already master that field. you have to learn from me 😛

    • Creative Simo 5:10 pm on August 2, 2008 Permalink | Reply

      Kalo saia too bat aja deh soal koding koding…:-)

    • tetangga sebelah 12:20 pm on August 3, 2008 Permalink | Reply

      Yang penting kan compiled code bukan source code, lebih penting lagi performance……..
      kalau aku perhatikan dan analisa (roy suryo mode = on) kode ibu walaupun lebih panjang tapi pake c++ yg yang merupakan compiled language, sedangkan kode pak budi walaupun pendek tapi pake perl jadi kalau dijalankan performansi kode ibu pasti weeee tetep kalah 😛 =))
      aku juga bingung sekarang itu kecuali grafik kode java dan perl itu bisa lebih cepat dari C++.
      JIT membuat C++ jadi tampak lemah,
      lebih sedih lagi untuk optimalisasi di c++ harus self service. semua dibikin statik dan inline, makin cepat tapi makin tidak fleksibel, cepat dan fleksibel harus metaprogramming……..ampun dechhhhh
      mending self service C++ mending self service resto……laperrrrrr

    • chikaradirghsa 3:18 pm on August 3, 2008 Permalink | Reply

      @creative simo: 🙂

      @tetangga sebelah: jadi menangin pak budi nih? hi hi hi… jadi gue kalah kemana2x ya? bae lah, da bisanya pake c/c++ jadi biarin lah emang selisih kecepatannya berapa sih orde-nya? kikikik….

    • Budi Rahardjo 5:47 am on August 4, 2008 Permalink | Reply

      yang jago adalah yang buat perl interpreter 🙂
      kok bisa-bisanya ya buat intepreter yang bagus (dan buat bahasa pemrograman yang penuh dengan keindahan … iya lho, perl itu indah).

    • chikaradirghsa 4:08 am on August 11, 2008 Permalink | Reply

      @BR: masih belum ngerti indahnya dimana 😛

  • CG 1:05 pm on July 17, 2008 Permalink | Reply
    Tags: , , ,   

    Boosting my coding with Boost Library 

    Reading books about how to use Boost Library. Will take some time but certainly will save more time than developing all the modules from the scratch.

    Got the feeling that once I advance metaprogramming then it will come in handy when I need it.

     
    • tetangga sebelah 8:22 pm on July 17, 2008 Permalink | Reply

      hehe…ada saya punya kabar buruk dan kabar baik tentang metaprogramming,
      Kabar buruk: saya adalah orang yang sempet frustasi belajar metaprogramming, ceritanya begini, tahun 1999 dulu saya pernah diminta membuat sebuah aplikasi yang bisa menerjemahkan data dari berbagai sentral telepon, data sentral telepon tersebut selain banyak (5000 data/menit) juga sangat banyak variannya, tiap seri sentral punya format masing2, supaya saya lebih pusing user juga minta aplikasi yang saya buat bisa dikembangkan untuk mengenali jenis data baru tanpa harus diubah pada level coding…….dari sini akhirnya saya menyimpulkan harus membuat parser… usaha membuat parser ini membuat saya bertemu dengan binatang bernama metaprogramming, dan gurunya compiler (Mr. Joe of Bandung Polytechnic). menghabiskan waktu hampir 6 bulan saya berusaha belajar metaprogramming termasuk dari buku yg dipinjem dari mr. joe, dan saya gagal……saya tidak bisa menyelesaikan membuat parser dan waktu proyek sudah mempet. akhirnya saya ambil jalan singkat, saya gunakan pattern2 yang ada di buku http://www.amazon.com/Framework-Based-Software-Development-Programming-Methodologies/dp/0135333652/ref=sr_1_5?ie=UTF8&s=books&qid=1216299600&sr=8-5 dan saya gagal memahami metaprogramming.

      Kabar Baik: berdasarkan pengalaman kita bisa menggunakan boost dengan produktif tanpa harus memahami metaprogramming, cukup tahu make template semuanya lancar. template metaprogramming. kalau kita pingin mengembangkan boost baru kita sebaiknya ngerti metaprogramming karena dengan teknik metaprogramming code kita lebih bercita rasa (singkat tapi bikin lieur).

      beberapa tahun setelah kegagalan belajar metaprogramming di th 1999 saya membutuhkan lagi skill metaprogramming, belajar dari kesalahan sebelumnya ternyat saya menyimpulkan sebagai berikut:
      1. memahami code dgn teknik metaprogramming tidak akan berarti kita bisa mengembangkan/membuat code dengan teknik metaprogramming.
      2. Untuk bisa mengembangkan kode dengan teknik metaprogramming harus tahu bagaimana cara compiler bekerja dengan source code, karena metaprogramming itu adalah merayu (memanfaatkan) compiler supaya membuat code untuk kita. untuk memahami compiler C++ saya sangat dibantu oleh buku http://www.amazon.com/Annotated-C-Reference-Manual/dp/0201514591/ref=pd_bbs_sr_7?ie=UTF8&s=books&qid=1216298585&sr=8-7
      dan buku http://www.amazon.com/Inside-Object-Model-Stanley-Lippman/dp/0201834545/ref=sr_11_1?ie=UTF8&qid=1216299107&sr=11-1

      3. wilujeung lieur………..

    • chikaradirghsa 9:41 am on July 18, 2008 Permalink | Reply

      hyalah, nuhun pisan tipsnya! gue baru aja mau posting ttg metaprogramming.

      i will post it anyway, but now i know that i don’t have to understand metaprogramming to use boost templates, which is good!

    • yaniwid 10:05 am on July 18, 2008 Permalink | Reply

      Happy coding… Kalau sudah mulai biasanya lupa berhenti lho…

    • chikaradirghsa 12:34 pm on July 18, 2008 Permalink | Reply

      @yaniwid: ya bagus kalau lupa berhenti. biar cepet selesai codingnya 😉

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