Newbie: Python & ADFGVX Cipher Cracking?
Noud Aldenhoven
jwaixs at freeler.nl
Wed Nov 17 10:08:51 EST 2004
Byron wrote:
> Hello,
>
> I am working on building a program that cracks "ADFGVX" ciphers.
> However, I have run into a minor problem, is has to do with figuring out
> the different potential character re-arrangement combinations. See
> example below for clarification:
>
> The characters "ABC" can be re-arranged in several different possible
> ways:
>
> 1) ABC
> 2) BAC
> 3) BCA
> 4) ACB
> 5) CAB
> 6) CBA
>
> Is there a python function in which I can sent a string of characters to
> -- and it will provide me with a list of all possible combinations
> available?
>
> example function call: possCharList = allCombinations("ABC")
>
> Any help SINCERELY appreciated!!
>
> Byron
> ---
Hello,
You mean something like this?
===================================
justanABClist = ["A","B","C"]
for letter in justanABClist:
for letter1 in justanABClist[1:]: #first letter already used
for letter2 in justanABClist[1:]:
print letter, letter1, letter2
justanABClist.append(justanABClist[0])
justanABClist.pop()
===================================
More information about the Python-list
mailing list