Newbie: Python & ADFGVX Cipher Cracking?
jwaixs at freeler.nl
Wed Nov 17 16:08:51 CET 2004
> 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
> 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
> example function call: possCharList = allCombinations("ABC")
> Any help SINCERELY appreciated!!
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
More information about the Python-list