Crazy Test: How much time will be consume to exhaustive 16 bits numeral for all possible?

本文通过实验估算使用穷举法破解16位数字密码所需时间,结果显示大约需要25年。考虑到资源消耗和复杂性的增加,文章讨论了这种方法的实际可行性。

Scenario:

This is a interesting personal testing during my job. I have been had a question about code-breaking. And I always want to find out how many time will be consume if a person want to use the method of exhaustion to crack a 16 bits password.

OK, following is my testing. If someone wants to crack a 16 bits password with the method of exhaustion. He/She has to generate 16 bit sequence in real time. (Of course, you can use password dictionary instead of generate sequence in real time. But that will be took up many space on your disk.)

To simplify our question, I developed a simple code to generate 8 bits sequence with recursion.

Code:

public class Calculate implements Runnable { private Object[] seed ; private int length ; private Object begin ; public Calculate(Object[] seed, Object begin, int length) { this.seed = seed ; this.begin = begin ; this.length = length ; } public void generateStr(String str, Object[] seed) { if(str.length()==length) { // System.out.println(str) ; // Global.addCount() ; return ; } else { for(int i=0 ; i<seed.length ; i++) { String temp = str ; str = str+seed[i] ; generateStr(str, seed) ; str = temp ; } } } }
Invoking:
Object[] seed = initCrackSeed(SeedType.NUMERAL) ;// 0,1,2,3,4,5,6,7,8,9 Calculate cal = new Calculate(seed, "" , 8) ; long startTime = System.nanoTime() ; cal.generateStr("", seed) ; long endTime = System.nanoTime() ; System.out.println("Time Consume: "+(endTime-startTime)/1000000000+" seconds.") ;
<!--
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
--><!--
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
-->

Result:

Time Consume: 8 seconds.
Now, you can see that it will spend 8 seconds to trave all 8 bit sequence. There must be 100,000,000 possibilities. So, if someone wants to trave all possibilities for 16 bit sequence, there should be 10,000,000,000,000,000 = 100,000,000 X 100,000,000 numbers. Therefore, it’s not hard to estimate the time consuming should be 8X100,000,000=800,000,000 second.

To be clear, 800,000,000 seconds = 800,000,000/60/60/24/365 = 25.3678 years.

25 years is really a huge time consuming to generate 16 bit numeral. In this case, we didn’t consider time consuming on other resource, like Network Communication Consume, the Max of System Continuous Running… In addition, if one password includes alphabet, numeral and punctuation, the work will be more terrible.

To summary, I think we can say that if we want to crack a 16 bit sequence, we must find out an faster way to generate these sequences. Otherwise, we have to wait untill 25 years later.

This is a quick testing for my interesting. If you have any good idea, please kindly share with me.

Thanks!

Xianyi.Ye

yexianyi@hotmail.com

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值