Wednesday, March 23, 2011

Those that I fight I do not hate,
Those that I guard I do not love.

Full poem

Saturday, March 12, 2011

Crypto codes: GGH public key cryptosystem

Download code from here
I only did the decryption part, using Babai's algorithm (for homework :D)

Friday, March 11, 2011

Crypto codes: Elliptic ElGamal

Download code from here

Crypto codes:Miller Rabin Primality test

Download code from here

Output: (exercise 3.14 in the Introduction of Mathematical Cryptography)
1105 is composite with witness 2
294409 is composite with witness 2
118901509 is prime
118901521 is composite with witness 2
118901527 is prime
118915387 is composite with witness 2

Crypto codes: Elliptic curve cryptography

Download code from here
Code includes:
Elliptic curve addition,
Point in Elliptic curve over finite fields
double-and-add algorithm for Elliptic curves

Output:
Points in E(F13) are :
(-Infinity,-Infinity)
(1.0,5.0)
(1.0,8.0)
(2.0,3.0)
(2.0,10.0)
(9.0,6.0)
(9.0,7.0)
(12.0,2.0)
(12.0,11.0)
Addition test->
(9.0,7.0) + (1.0,8.0) =(2.0,10.0)
double-and-add algorithm for elliptic curve->
947*(6.0,730.0) mod 3623= (3492.0,60.0)

Friday, February 25, 2011

Crypto codes: Pollard’s p − 1 factorization algorithm

Code here
It uses prime factor code from square root

Output shows the steps of the algorithm with results:
Find prime factors of 48356747:
2^19! -1 = 13944673 (mod 48356747)
gcd(2^19!-1,48356747) = 6917
factors of 48356747, p=6917, and q=48356747/6917=6991
The prime factorization of 6916 is: 2, 2, 7, 13, 19

The prime factorization of 6990 is: 2, 3, 5, 233

Thursday, February 24, 2011

Day `haven't-count-for-a-while:' Congratulations! You Won!

All the emails congratulate me, turn out to be spam.
I love you spammers, you keep me going.

Sunday, February 13, 2011

Monday, February 07, 2011

Crypto codes (3)

Download from here
For the inverse and fast squaring code, see Crypto codes: 1

Finds eth root modulo p:

public class RSA {

 //find x from x^e = c (mod p)
  public static long findRoot(long e, long c, long p)
  {
   long x = 0;
   
   //find e^-1 (mod p-1)
   long eInverse = crypto.inverse(p-1, e);
   
   //x = c^d (mod p)
   x = crypto.fastSq(p, c, eInverse);
   
   return x;
  }
       //test: answer = 6059
  public static void main(String[] args) {
   
      long e = 1583;
      long c = 4714;
      long p = 7919;
      
   long x = RSA.findRoot(e,c, p);
   System.out.println("Solution to x^"+e+" = "+c+" (mod "+p+"): x= "+x);
  }

}

This test will return:
Solution to x^1583 = 4714 (mod 7919): x= 6059

Matlab codes: http://www-users.math.umd.edu/~lcw/MatlabCode/

Wednesday, February 02, 2011

Crypto codes: Chinese remainder theorem

For gcd and inverse code, see Crypto codes

Java implementation of Chinese remainder theorem, download from here
Matlab code here

For this particular example, output will look like the following:

Step:0->x=2+3*5=17
Step:1->x=17+21*7=164
Solution:164

Sunday, January 23, 2011

Tuesday, January 04, 2011

Thursday, December 30, 2010

The bubbles are not reality but it's inside your mind



The bubbles are not reality but it's inside your mind, originally uploaded by sheetal_shundori.
We live in a bubble baby.
A bubble's not reality.
You gotta have a look outside.
Listen

Tuesday, December 21, 2010

Latex resume templates: http://www.rpi.edu/dept/arc/training/latex/resumes/

Girls Scout and my incoherent ramblings

Last month I attended the Girls Scout Saturdays event,  arranged by Drexel Ischool for introducing high school girls to Computer Science. I must say it was an amazing experience. When I was a high school student in Bangladesh, my school had an educational program where the high school students had to teach uneducated female garments factory workers. It was a highlight of my high school years. I love these sorts of events because I live in a tiny bubble of people who are like me, and mostly have the same educational/social background. These events give me a sneak peek of the rest of world which is completely different and remind me of a world, which I hardly think, exists. Also they remind me that I might seem really dumb in a world full of intellectuals but I am still useful to some other part of the world :-D.

Anyway, I was talking about my experience with the girls scout. I was invited to this event because I was once a software developer and I was supposed to talk about my experience. The event was for 6-12 graders. I had 12 graders in mind when I was preparing my presentation. But to my surprise, I saw that my audience was a group of 6-12 years "old" girls and I don't know how to talk software engineering with the people so tiny!  They all have facebook accounts and they use youtube, skype, emails. In someways, they know more about internet and games and softwares than I used to at that age, (I had my first computer at 20 and snails are faster than internet in Bangladesh). And the scary thing was that when I showed them a real site and a phishing site, no one could detect the fake site. They use internet everyday but they don't know the basic rules of security that why a webpage that looks real might not be real, why it's not good to download every attachment and click on every link in an email that is apparently coming from a friend and why it's not okay to click "Accept" every time your browser gives you a choice. These security decisions are hard even for the adults! How it is possible to make them understandable for these kids? Now I think I understand what Ross Anderson was saying about security and usability that most systems are not designed to consider all kinds of users. Just imagine that you let your kid (or your old parents or anyone) to check emails using your laptop and she downloads every attachments her friend sends and thus installs trozans and keyloggers on your laptop that you use to check your bank accounts. All that encryption and SSL on your bank site won't save your credentials to become a product in the hackers' market. One weak link in the security-chain completely breaks the whole system.

In these days everything I see or read or do or think, brings back this insecurity complex. On another note, the outside world just seems to be getting too interesting to disregard.