Newbie: Python & ADFGVX Cipher Cracking?

Byron DesertLinux at netscape.net
Wed Nov 17 16:37:42 CET 2004


Hi Andreas,

That works GREAT!!  Thanks for the help...  It is appreciated!

Byron
---



Andreas Lobinger wrote:
> Aloha,
> 
> Byron wrote:
> 
>> I am working on building a program that cracks "ADFGVX" ciphers. 
>> However, I have run into a minor problem, which has to do with 
>> figuring out all of the possible character re-arrangement 
>> combinations.  sible ways:
> 
> 
>> 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?
> 
> 
> I thought i had encountered something like that in random or so, but
> in fact a working solution is used as an _example_ in refman 2.1.8.
> 
> def perm(l):
>         # Compute the list of all permutations of l
>     if len(l) <= 1:
>                   return [l]
>     r = []
>     for i in range(len(l)):
>              s = l[:i] + l[i+1:]
>              p = perm(s)
>              for x in p:
>               r.append(l[i:i+1] + x)
>     return r
> 
> lobinger at biscuit: python
> Python 2.2.2 (#3, Apr 10 2003, 17:06:52)
> [GCC 2.95.2 19991024 (release)] on sunos5
> Type "help", "copyright", "credits" or "license" for more information.
>  >>> import perm
>  >>> perm.perm('ABC')
> ['ABC', 'ACB', 'BAC', 'BCA', 'CAB', 'CBA']
>  >>>
> 
> Wishing a happy day
>         LOBI



More information about the Python-list mailing list