最快的尝试所有字符串的方法(直到ZZZZZZZZZZZZZZZZZZZZZZZZ) [英] FASTEST way to try all strings (a until ZZZZZZZZZZZZZZZZZZZZZZZZ)

查看:151
本文介绍了最快的尝试所有字符串的方法(直到ZZZZZZZZZZZZZZZZZZZZZZZZ)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




我需要找到最快的方法来获取循环中的字符串,从a

到 ZZZZZZZZZZZZZZZZZ"。

所以它必须是这样的:


a

b

... 。

z

A

....

Z

aa

ab

....

az

aA

....

ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ


所以它必须尝试各种组合与所有26个字母,使大写和小写之间的

的区别,空间()也必须包含




有没有人知道这样做的方法?

我不需要这个来破解任何密码或其他东西:我正在使用

比利时政府的电子身份证SDK。对于

一些@%£&§* $ !!之所以这些家伙在那里发生了一些重大错误,并且以愚蠢的方式将参数与信息一起使用。一半他们的b $ b他们都没有工作......所以找出失踪

参数的唯一方法是:

1。向他们询问信息,但他们似乎是愚蠢地知道他们自己制作的东西......

2.尝试各种字母组合......所以这就是我想要做的事情:-)
我想出了这个:但它的工作速度并不像我想的那样快......

dblBegin = 0

dblEnd = 52 ^ 30

。对于dblTeller = dblBegin要dblEnd

STRT = GiveWord()

TestValue(strT)

txtWord.Text = strT

Application.DoEvents()

下一页

私有函数GiveWord()As String

Dim strA As String =""

Dim dblRest As Double

Dim dblQuotient As双倍

dblQuotient = dblTeller



dblRest = dblQuotient Mod 53

''1-26 = az

''27 -52 = AZ

如果dblRest = 0那么

dblRest = 32''空间

ElseIf dblRest< 27然后

dblRest = dblRest + 96

否则

dblRest = dblRest + 38

结束如果

strA = Chr(dblRest)& strA

dblQuotient = dblQuotient \ 53

循环直到dblQuotient = 0

GiveWord = strA

结束函数

解决方案

!!之所以这些家伙在那里发生了一些重大错误,并且以愚蠢的方式将参数与信息一起使用。一半他们的b $ b他们都没有工作......所以找出失踪

参数的唯一方法是:

1。向他们询问信息,但他们似乎是愚蠢地知道他们自己制作的东西......

2.尝试各种字母组合......所以这就是我想要做的事情:-)
我想出了这个:但它的工作速度并不像我想的那样快......

dblBegin = 0

dblEnd = 52 ^ 30

对于dblTeller = dblBegin要dblEnd

strT = GiveWord()

TestValue(strT)

txtWord.Text = strT

Application.DoEvents()

下一页

私有函数GiveWord()As String

Dim strA As String =""

Dim dblRest As Double

Dim dblQuotient As双倍

dblQuotient = dblTeller



dblRest = dblQuotient Mod 53

''1-26 = az

''27 -52 = AZ

如果dblRest = 0那么

dblRest = 32''空间

ElseIf dblRest< 27然后

dblRest = dblRest + 96

否则

dblRest = dblRest + 38

结束如果

strA = Chr(dblRest)& strA

dblQuotient = dblQuotient \ 53

循环直到dblQuotient = 0

GiveWord = strA

结束函数


DraguVaso< pi ********** @ hotmail.com>写道:我需要找得到循环中的某个字符串以最快的方式,从"去; A"
到" ZZZZZZZZZZZZZZZZZ"


即使只使用17个字符(与下面给出的最后一个字符不同)

也有一些荒谬的组合。你只是*不能* b $ b来测试它们中的每一个。有53个符号(az,AZ,空格)你得到

205442259656281392806087233013组合。


假设你每秒可以处理100亿* *它们会

还需要65145313183年才能完成所有这些工作。你真的好吗?b $ b有那么多时间吗?


现在,至于加速你所拥有的东西:使用StringBuilder代替

重复字符串连接将是一个良好的开端。或者

你可以使用char数组。 (我没有检查你的实际算法

的正确性,顺便说一句。)


我注意到你使用52 ^ 30作为数字可能的组合,

我不太明白,如果你包括空间,但即便如此,

使得时间的长度更大。


假设你有一百万台计算机*每个*处理1000亿

组合一秒钟,以通过52 ^ 30组合我怀疑

你必须等到太阳冷却后看到

结束。


换句话说:你''我需要找到一种不同的方式来接近你的

问题...


-

Jon Skeet - < sk ***@pobox.com>
http://www.pobox.com /〜双向飞碟

如果回复小组,请不要给我发邮件


呵呵,好吧,我找到了其中一些人有4个我们的5个字符,但是对于每个角色来说,对于每一个角色来说,更多的时间需要指数更多的时间

才能找到它。而且我认为aleaddy我会很快达到我的限制

(已经有10个字符已经花了10分钟......)。


但是,我仍然幸运的是:政府并不在乎我们这么多,但想要向我们出售读卡器的公司并不想要

错过了与比利时一些最大的连锁店的合同,并且

他们给了我参数,呵呵:-)


在cae别人需要它们:


ID键:

-----------

CardNumber,ChipNumber ,BeginValidityDate,EndValidityDate,

IssuingMunicipality,NationalNumber,名称,FIRSTNAME1,FIRSTNAME2,

FIRSTNAME3,

国籍,出生地,出生日期,性别,NobilityTitle ,DocumentType,

WhiteCane,YellowCane,ExtendedMinority

Adres键:

----------- ----

Street,HouseNumber,BoxNumber,ZIPCode,Municipality,Country

图片键:

---------------

图片

不管怎样,谢谢你们!


Pieter

" Jon Skeet [C#MVP]" < SK *** @ pobox.com>在消息中写道

新闻:MP ************************ @ msnews.microsoft.c om ...

DraguVaso< pi ********** @ hotmail.com>写道:

我需要找到最快的方法来获取循环中的字符串,该字符串来自
a。到" ZZZZZZZZZZZZZZZZZ"


即使仅使用17个字符(不像下面给出的最后一个you''ve)
有组合的荒谬数。你只是*不会*能够测试他们中的每一个。有53个符号(az,AZ,空格)你就得到了
205442259656281392806087233013组合。

假设你每秒可以处理100亿* *,那它还会带你65145313183几年来经历这一切。你真的有这么多时间吗?

现在,至于加速你所拥有的:使用StringBuilder而不是重复字符串连接将是一个好的开始。或者
你可以使用char数组。 (我没有检查你的实际算法
是否正确,顺便说一句。)

我注意到你使用52 ^ 30作为可能组合的数量,
我不太明白,如果你包括空间,但即便如此,
这使得时间的长度变得更大。

假设你有一百万台计算机*每个*每秒处理1000亿个组合,以达到52 ^ 30种组合我怀疑你必须等到太阳冷却后才能看到
结束。<换句话说:你需要找到一种不同的方法来解决你的问题...

-
Jon Skeet - < ; sk *** @ pobox.com>
http://www.pobox .com / ~siget
如果回复小组,请不要给我发邮件



Hi,

I need to find the FASTEST way to get a string in a Loop, that goes from "a"
to "ZZZZZZZZZZZZZZZZZ".
So it has to go like this:

a
b
....
z
A
....
Z
aa
ab
....
az
aA
....
ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ

So it has to try every combination with all the 26 letters, making a
difference between upper case and lower case, and the space (" ") has to be
included too.

Does anybody knows a way to do this?
I do not need this to hack any password or stuff liek this: I''m working with
the SDK of the Belgian governemnet for the electronic identity card. For
some @%£&§*$!! reason these guys made some big mistakes in there
documentation, and used the parameters with the info on a stupid way. Half
of them aren''t working.... So the only ways to find out the missing
paramters is:
1. ask them for info, but they seem to be to stupid to knwo anything about
the stuff they made themselves...
2. Try avery combination of letters... So that''s what I want to do :-)
I came up with this: but it doesn''t work as fast as I want to...

dblBegin = 0
dblEnd = 52 ^ 30
For dblTeller = dblBegin To dblEnd
strT = GiveWord()
TestValue(strT)
txtWord.Text = strT
Application.DoEvents()
Next
Private Function GiveWord() As String
Dim strA As String = ""
Dim dblRest As Double
Dim dblQuotient As Double
dblQuotient = dblTeller
Do
dblRest = dblQuotient Mod 53
''1-26 = a-z
''27-52 = A-Z
If dblRest = 0 Then
dblRest = 32 ''space
ElseIf dblRest < 27 Then
dblRest = dblRest + 96
Else
dblRest = dblRest + 38
End If
strA = Chr(dblRest) & strA
dblQuotient = dblQuotient \ 53
Loop Until dblQuotient = 0
GiveWord = strA
End Function

解决方案

!! reason these guys made some big mistakes in there
documentation, and used the parameters with the info on a stupid way. Half
of them aren''t working.... So the only ways to find out the missing
paramters is:
1. ask them for info, but they seem to be to stupid to knwo anything about
the stuff they made themselves...
2. Try avery combination of letters... So that''s what I want to do :-)
I came up with this: but it doesn''t work as fast as I want to...

dblBegin = 0
dblEnd = 52 ^ 30
For dblTeller = dblBegin To dblEnd
strT = GiveWord()
TestValue(strT)
txtWord.Text = strT
Application.DoEvents()
Next
Private Function GiveWord() As String
Dim strA As String = ""
Dim dblRest As Double
Dim dblQuotient As Double
dblQuotient = dblTeller
Do
dblRest = dblQuotient Mod 53
''1-26 = a-z
''27-52 = A-Z
If dblRest = 0 Then
dblRest = 32 ''space
ElseIf dblRest < 27 Then
dblRest = dblRest + 96
Else
dblRest = dblRest + 38
End If
strA = Chr(dblRest) & strA
dblQuotient = dblQuotient \ 53
Loop Until dblQuotient = 0
GiveWord = strA
End Function


DraguVaso <pi**********@hotmail.com> wrote:

I need to find the FASTEST way to get a string in a Loop, that goes from "a"
to "ZZZZZZZZZZZZZZZZZ".



Even using just 17 characters (unlike the last one you''ve given below)
there are a ridiculous number of combinations. You just *won''t* be able
to test every one of them. With 53 symbols (a-z, A-Z, space) you get
205442259656281392806087233013 combinations.

Assuming you could process 100 *billion* of them every second, it would
still take you 65145313183 years to go through them all. Do you really
have that much time?

Now, as for speeding up what you''ve got: using a StringBuilder instead
of repeated string concatenation would be a good start. Alternatively
you could use a char array. (I haven''t checked your actual algorithm
for correctness, btw.)

I note that you''re using 52^30 as the number of possible combinations,
which I don''t quite understand if you''re including space, but even so,
that makes the length of time taken even greater.

Suppose you have a million computers *each* processing 100 billion
combinations a second, to get through 52^30 combinations I suspect
you''d have to wait until way after the sun had gone cold to see the
end.

In other words: you''ll need to find a different way of approaching your
problem...

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too


Hehe, well, I found alreaddy some of them that had 4 our 5 characters, but
offcourse, for every character more it would take me exponential more time
to find it out. And I assumed aleaddy I would get very soon to my limit
(getting to 5 characters took already 10 minutes...).

But nevertheless, I''ve been lucky: The governement doesn''t care a lot about
us, but the company that wants to sell to us the card-readers doesn''t want
to miss a contract with some of the biggest chains of stores in belgium, and
they gave me the parameters, hehe :-)

In cae somebody else needs them:

ID Keys:
-----------
CardNumber, ChipNumber, BeginValidityDate, EndValidityDate,
IssuingMunicipality, NationalNumber, Name, FirstName1, FirstName2,
FirstName3,
Nationality, BirthPlace, BirthDate, Gender, NobilityTitle, DocumentType,
WhiteCane, YellowCane, ExtendedMinority

Adres keys:
---------------
Street, HouseNumber, BoxNumber, ZIPCode, Municipality, Country

Picture keys:
---------------
Picture
Thanks anyways guys!

Pieter
"Jon Skeet [C# MVP]" <sk***@pobox.com> wrote in message
news:MP************************@msnews.microsoft.c om...

DraguVaso <pi**********@hotmail.com> wrote:

I need to find the FASTEST way to get a string in a Loop, that goes from "a" to "ZZZZZZZZZZZZZZZZZ".



Even using just 17 characters (unlike the last one you''ve given below)
there are a ridiculous number of combinations. You just *won''t* be able
to test every one of them. With 53 symbols (a-z, A-Z, space) you get
205442259656281392806087233013 combinations.

Assuming you could process 100 *billion* of them every second, it would
still take you 65145313183 years to go through them all. Do you really
have that much time?

Now, as for speeding up what you''ve got: using a StringBuilder instead
of repeated string concatenation would be a good start. Alternatively
you could use a char array. (I haven''t checked your actual algorithm
for correctness, btw.)

I note that you''re using 52^30 as the number of possible combinations,
which I don''t quite understand if you''re including space, but even so,
that makes the length of time taken even greater.

Suppose you have a million computers *each* processing 100 billion
combinations a second, to get through 52^30 combinations I suspect
you''d have to wait until way after the sun had gone cold to see the
end.

In other words: you''ll need to find a different way of approaching your
problem...

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too



这篇关于最快的尝试所有字符串的方法(直到ZZZZZZZZZZZZZZZZZZZZZZZZ)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆