An attack on RSA

March 17th, 2009

A simple concept on cracking RSA

The security of RSA is based on a math problem. For 2 huge(1000 bits) prime numbers p and q. We have n = p * q. Agreement on that: knowing n, calculating p and q is impossible right now.

But if p and q are close together (close means |p-q| < 1,000,000,000), the we’ve got a change

n = p*q = (p+q / 2)^2 - (p-q / 2)^2

Denotes T = √(p+q / 2)^2 and S = √(p-q/ 2)^2

if p and q are close

then S is close to 0

and T is close to √n

now start look at the following numbers

⌈√n⌉,⌈√n⌉+1,⌈√n⌉+2,⌈√n⌉+3,…

stop when we find a n that make t^2 - n is a perfect square number

and we’ve got the value of p and q.

Fun

Fable - The Lost Chapters

February 3rd, 2009

Great game, ported by FEARL.

Picture 2

Picture 1

download links

http://rapidshare.com/files/192567471/Fable_-_The_Lost_Chapters.dmg.001
http://rapidshare.com/files/192567481/Fable_-_The_Lost_Chapters.dmg.002
http://rapidshare.com/files/192567546/Fable_-_The_Lost_Chapters.dmg.005
http://rapidshare.com/files/192567569/Fable_-_The_Lost_Chapters.dmg.004
http://rapidshare.com/files/192567581/Fable_-_The_Lost_Chapters.dmg.003
http://rapidshare.com/files/192569368/Fable_-_The_Lost_Chapters.dmg.006
http://rapidshare.com/files/192569395/Fable_-_The_Lost_Chapters.dmg.009
http://rapidshare.com/files/192569545/Fable_-_The_Lost_Chapters.dmg.008
http://rapidshare.com/files/192569579/Fable_-_The_Lost_Chapters.dmg.007
http://rapidshare.com/files/192569649/Fable_-_The_Lost_Chapters.dmg.010
http://rapidshare.com/files/192571638/Fable_-_The_Lost_Chapters.dmg.011
http://rapidshare.com/files/192571961/Fable_-_The_Lost_Chapters.dmg.012
http://rapidshare.com/files/192572053/Fable_-_The_Lost_Chapters.dmg.014
http://rapidshare.com/files/192572092/Fable_-_The_Lost_Chapters.dmg.013
http://rapidshare.com/files/192572167/Fable_-_The_Lost_Chapters.dmg.015
http://rapidshare.com/files/192574165/Fable_-_The_Lost_Chapters.dmg.016
http://rapidshare.com/files/192574418/Fable_-_The_Lost_Chapters.dmg.017
http://rapidshare.com/files/192574538/Fable_-_The_Lost_Chapters.dmg.018
http://rapidshare.com/files/192574599/Fable_-_The_Lost_Chapters.dmg.019
http://rapidshare.com/files/192574614/Fable_-_The_Lost_Chapters.dmg.020
http://rapidshare.com/files/192575443/Fable_-_The_Lost_Chapters.dmg.024
http://rapidshare.com/files/192576619/Fable_-_The_Lost_Chapters.dmg.021
http://rapidshare.com/files/192576648/Fable_-_The_Lost_Chapters.dmg.023
http://rapidshare.com/files/192576766/Fable_-_The_Lost_Chapters.dmg.022

unarchive password Cheesytoe

Games

Flickr

January 23rd, 2009

This is a test post from flickr, a fancy photo sharing thing.

General

Use recursion to achieve Fibonacci numbers

January 21st, 2009

查看本文的中文版,请点击这里

Last article illustrated how to use the recursion to achieve factorial calculation by a simple example, and this article will show another classic application of recursion - Fibonacci numbers.

Fibonacci numbers refers to such an infinite numbers: 1, 1, 2, 3, 5, 8, etc. Except the first two numbers, each number is the sum of the two preceding numbers.

Since the Fibonacci numbers is defined by recurrence relation, then we can easily use recursion to achieve its calculation.

As the calculation of factorial, the bigger of the numerical calculation, the more times of recursion, and the number of redundant recursion will growth in a redundant geometric way, the efficiency of program will also be lower and lower (you can modify the program, personally test it). So you need according to the actual situation, and make a decision between readability and efficiency.

Example: Print 10 Fibonacci numbers. Use recursion to achieve it.

Code:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
 
namespace Fibonacci
{
    class Program
    {
        public long Fibonacci(int n)
        {
            if (n > 0 && (n == 1 || n == 2))
            {
                return 1;
            }
            else
            {
                return Fibonacci(n - 1) + Fibonacci(n - 2);
            }
        }
 
        static void Main(string[] args)
        {
            Program p = new Program();
            for (int i = 1; i < 11; i++)
            {
                Console.Write(p.Fibonacci(i));
            }
        }
    }
}

Algorithm, C# , ,

Use recursion to achieve factorial calculation

January 20th, 2009

查看本文的中文版,请点击这里

According to the characteristics of factorial calculation, using recursion to achieve it is very convenient.

Note that recursion is a kind of low efficiency algorithm, especially when calculate with larger operations, so give careful consideration to the circumstances in deciding whether to use it.

This is a example of algorithm I wrote when learning C# programming language.

Example: Calculate 1! + 2! + … + 10! and print out the results. Use recursion to achieve it.

Code:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
 
namespace Factorial
{
    class Program
    {
        public long Factorial(int n)
        {
            if (n == 0 || n == 1)
            {
                return 1;
            }
            else
            {
                return n * Factorial(n - 1);
            }
        }
 
        static void Main(string[] args)
        {
            Program p = new Program();
            long sum = 0;
            for (int i = 1; i < 11; i++)
            {
                sum += p.Factorial(i);
            }
            Console.WriteLine("1! + 2! + ... + 10! = " + sum);
        }
    }
}

Algorithm, C# , ,

Red Alert 3 on mac

January 17th, 2009

This an official port made by me. Everything works fine expect the auto-update. When the update window appears and asks you to update, just click “no”

Picture 1.png

Picture 2.png

Picture 3.png

Picture 4.png

Picture 5.png

Picture 6.png

If you have any problems, please leave a comment.

Download links:

http://rapidshare.com/files/184102994/RA3Cider.app.part04.sitx

http://rapidshare.com/files/184105190/RA3Cider.app.part01.sitx

http://rapidshare.com/files/184105302/RA3Cider.app.part03.sitx

http://rapidshare.com/files/184106918/RA3Cider.app.part05.sitx

http://rapidshare.com/files/184107476/RA3Cider.app.part02.sitx

http://rapidshare.com/files/184181702/RA3Cider.app.part06.sitx

http://rapidshare.com/files/184183191/RA3Cider.app.part09.sitx

http://rapidshare.com/files/184184110/RA3Cider.app.part08.sitx

http://rapidshare.com/files/184184654/RA3Cider.app.part07.sitx

http://rapidshare.com/files/184188633/RA3Cider.app.part10.sitx

http://rapidshare.com/files/184299299/RA3Cider.app.part19.sitx

http://rapidshare.com/files/184397938/RA3Cider.app.part16.sitx

http://rapidshare.com/files/184401204/RA3Cider.app.part18.sitx

http://rapidshare.com/files/184402077/RA3Cider.app.part17.sitx

http://rapidshare.com/files/184441411/RA3Cider.app.part11.sitx

http://rapidshare.com/files/184447574/RA3Cider.app.part15.sitx

http://rapidshare.com/files/184447915/RA3Cider.app.part12.sitx

http://rapidshare.com/files/184448028/RA3Cider.app.part13.sitx

http://rapidshare.com/files/184448352/RA3Cider.app.part14.sitx

Games

High Performance with PHP

January 15th, 2009

Preface

This article isn’t oriented a fresh man. so if you want to ask something about how to, please search before your ask. :)

  1. Compile your php code into opcode
    Zend Optimizer, eAccelerator, APC, XCache
  2. Using shared memory to boost your application
    You may use those extensions that i mentioned above, but i think memcache is more better. If you’re going to build a large application, memcache is necessary.
  3. Using apc / hidef instead of define statement
    Many people may ignore this… yes, this is a small optimization. I just listed it here if you have many constant defined.
  4. Using xdebug to profiling your application
    In many case, the application’s choke point is not in database but application’s logic. So you could turn on xdebug’s profilling, then use CacheGrind to view the output to see where the problem is.

PHP, Web Development , , ,

A fancy download tool for websites like rapidshare, megaupload etc

January 11th, 2009

Have you ever been bothered in fetching big files from some fire-sharing sites like rapidshare or megaupload?

Here a great tool to save your time. With Jdownloader, you just need to input all download links at one time. It will arrange download schedule automatically, even fill in those random character for you

Download it at here

What’s more, it’s cross-platform, that is, u can use it on windows mac or linux.

Picture 1.png

Linux, Software, Windows , ,

如何破解WEP加密的无线网络

December 4th, 2008

To view this ariticle in English, please click here

Linux是破解WEP网络的最好平台, 如果你希望在windows上破解,也不是不可以. 但是得给自己网卡安装一个改版驱动来打开网卡的监视功能

工具:

软件: aircrack-ng 平台: Linux 2.6.27 硬件: Intel 2200BG 无线网卡

安装:

  1. 确保无线网卡在linux下能正常工作, 如果不行 请访问相应的站点自行解决
  2. 安装aircrack-ng 工具包, 你可以通过linux发行版自带的包管理器来安装

  • ArchLinux 用户: pacman -S aircrack-ng
  • Debian & ubuntu用户: apt-get install aircrack-ng

  • Fedora 用户: 先添加源 Dag WieersDries, 然后输入 yum -y install aircrack-ng

数据抓取:

  1. 通过这个命令打开无线网卡的监视功能: airmon-ng start <interface>.                                                             命令返回的结果应该是这样
  2. 开始监视周围的无线网络: airodump-ng <interface>
  3. 稍等片刻, 直到某些正在使用的无线网络出现,如图     然后你就可以选择一个破解的目标了
  4. 输入这个命令 捕获无线AP与客户机之间的数据流, airodump-ng –bssid xx:xx:xx:xx:xx:xx -w dump <interface>     

破解:

  1. 当你觉得收集到了足够的数据包时(一般情况下dump文件在40k到85k之间).                                                   就可以通过这个命令破解了: aircrack-ng -b xx:xx:xx:xx:xx:xx dump-01.cap                                                         -b 参数后面的mac地址即是你要破解的无线AP的mac地址
  2. Just wait & enjoy

Linux

How to crack a WEP encrypted wireless network

December 4th, 2008

查看本文的中文版 请点击这里

Linux is the best platform to do this job, of course u can hack a WIFI under windows as well, in that case u need to install a modded driver for your NIC to open monitor feature.

Tool:

aircrack-ng Platform: Linux 2.6.27 Hardware: Intel 2200BG Wireless network adapter

Installation:

  1. Make sure your wireless network card works well on linux. If u have questions, please visit wiki of your linux distro.
  2. Install aircrack-ng pack. U can simply do this through your package manager
  • For ArchLinux user:  pacman -S aircrack-ng
  • For debian & ubuntu: apt-get install aircrack-ng
  • For fedora: First add this repository Dag Wieers or Dries, then yum -y install aircrack-ng

Data Capture:

  1. Open the monitor function of your NIC through this command: airmon-ng start <interface>. then it should look like this:
  2. Start to capture data steam, airodump-ng <interface>
  3. Wait for a while, untill some APs and  associated clients show up. Then u can choose a target to hack
  4. Type this command to capture data between your target AP and associated client, airodump-ng  –bssid xx:xx:xx:xx:xx:xx -w dump <interface>

Cracking:

  1. When you think you have collected enough packet(usually the size of dump.cap should be between 40k to 85k). U can start to crack by this simple command: aircrack-ng -b xx:xx:xx:xx:xx:xx dump-01.cap                                 The MAC after the -b option is the BSSID of the target and dump-01.cap the file containing the captured packets. You can use multiple files, just add all their names or you can use a wildcard such as dump*.cap.
  2. Just wait & enjoy

Linux