Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > sci.crypt > #50300

Re: Toy cipher I made for a reddit challenge

From wizzofozz <oxxxxxxxxxxxs@gmail.com>
Newsgroups sci.crypt
Subject Re: Toy cipher I made for a reddit challenge
Date 2021-10-02 17:25 +0200
Organization A noiseless patient Spider
Message-ID <sj9tl8$8he$1@dont-email.me> (permalink)
References (7 earlier) <sj7r3v$avt$1@dont-email.me> <sj8fl6$b86$1@gioia.aioe.org> <sj9bli$1ui7$1@gioia.aioe.org> <sj9fo1$9dd$1@dont-email.me> <sj9q5b$lc3$1@gioia.aioe.org>

Show all headers | View raw


Op 2-10-2021 om 16:25 schreef Max:
> On 02.10.21 13:28, wizzofozz wrote:
>> Op 2-10-2021 om 12:18 schreef Max:
>>
>>>
>>> Ok. This isn't the only possible order in which to sort the letters. 
>>> Some steps are forced, but not all. E.g., for the 3rd b one could 
>>> either move the L to the right or the P to the left. This creates a 
>>> tree. Have to dig into this later.
>>>
>>
>> I just tested with an implementation which uses a "left list" and 
>> "right list". I think this slightly different 
> 
> I like this thinking.
> 
>>
>> Some code:
>>
> 
> Nice. I hope you are no Python purist, as I slaughtered your code and 
> hacked it into this abomination. It doesn't take any arguments.

I'm certainly not a Python purist, and cool that you used my code. I'll 
have to study yours a bit to see how it works, but I think I understand 
what you're doing. I added to your code, a little loop to check all the 
permutations of the characters which were missing for the mapping.
Interestingly, only solutions are found for the one we assumed correct 
(I think I implemented the loop correctly, code at the end of the post).

I glanced over your list to see if there was an obvious 
"babbylevelsoeasy" candidate but none found yet. Tonight I'll be doing 
other things, but I'll keep an eye out for new posts.

Output of your search within the "permutations loop":

WVUPMOABCDEFGXYHJLKQRSTZIN

WVUPMOABCDEFGXYHJLKQRSTNIZ

WVUPMOABCDEFGXYHZLKQRSTJIN

WVUPMOABCDEFGXYHZLKQRSTNIJ

WVUPMOABCDEFGXYHNLKQRSTJIZ

WVUPMOABCDEFGXYHNLKQRSTZIJ

WVUPMOABCDEFGXYJHLKQRSTZIN

WVUPMOABCDEFGXYJHLKQRSTNIZ

WVUPMOABCDEFGXYJZLKQRSTHIN

WVUPMOABCDEFGXYJZLKQRSTNIH

WVUPMOABCDEFGXYJNLKQRSTHIZ

WVUPMOABCDEFGXYJNLKQRSTZIH

WVUPMOABCDEFGXYZHLKQRSTJIN

WVUPMOABCDEFGXYZHLKQRSTNIJ

WVUPMOABCDEFGXYZJLKQRSTHIN

WVUPMOABCDEFGXYZJLKQRSTNIH

WVUPMOABCDEFGXYZNLKQRSTHIJ

WVUPMOABCDEFGXYZNLKQRSTJIH

11100001011011111111010101101010
dcabbcddddbbbccc
11100001011011111111010110011010
dcabbcddddbbcbcc
11100001011011111111010110100110
dcabbcddddbbccbc
11100001011011111111010110101001
dcabbcddddbbcccb
11100001011011111111011001011010
dcabbcddddbcbbcc
11100001011011111111011001100110
dcabbcddddbcbcbc
11100001011011111111011001101001
dcabbcddddbcbccb
11100001011011111111011010010110
dcabbcddddbccbbc
11100001011011111111011010011001
dcabbcddddbccbcb
11100001011011111111011010100101
dcabbcddddbcccbb
11100001011011111111100101011010
dcabbcddddcbbbcc
11100001011011111111100101100110
dcabbcddddcbbcbc
11100001011011111111100101101001
dcabbcddddcbbccb
11100001011011111111100110010110
dcabbcddddcbcbbc
11100001011011111111100110011001
dcabbcddddcbcbcb
11100001011011111111100110100101
dcabbcddddcbccbb
11100001011011111111101001010110
dcabbcddddccbbbc
11100001011011111111101001011001
dcabbcddddccbbcb
11100001011011111111101001100101
dcabbcddddccbcbb
11100001011011111111101010010101
dcabbcddddcccbbb
11100001100111111111010101101010
dcabcbddddbbbccc
11100001100111111111010110011010
dcabcbddddbbcbcc
11100001100111111111010110100110
dcabcbddddbbccbc
11100001100111111111010110101001
dcabcbddddbbcccb
11100001100111111111011001011010
dcabcbddddbcbbcc
11100001100111111111011001100110
dcabcbddddbcbcbc
11100001100111111111011001101001
dcabcbddddbcbccb
11100001100111111111011010010110
dcabcbddddbccbbc
11100001100111111111011010011001
dcabcbddddbccbcb
11100001100111111111011010100101
dcabcbddddbcccbb
11100001100111111111100101011010
dcabcbddddcbbbcc
11100001100111111111100101100110
dcabcbddddcbbcbc
11100001100111111111100101101001
dcabcbddddcbbccb
11100001100111111111100110010110
dcabcbddddcbcbbc
11100001100111111111100110011001
dcabcbddddcbcbcb
11100001100111111111100110100101
dcabcbddddcbccbb
11100001100111111111101001010110
dcabcbddddccbbbc
11100001100111111111101001011001
dcabcbddddccbbcb
11100001100111111111101001100101
dcabcbddddccbcbb
11100001100111111111101010010101
dcabcbddddcccbbb
11100010010111111111010101101010
dcacbbddddbbbccc
11100010010111111111010110011010
dcacbbddddbbcbcc
11100010010111111111010110100110
dcacbbddddbbccbc
11100010010111111111010110101001
dcacbbddddbbcccb
11100010010111111111011001011010
dcacbbddddbcbbcc
11100010010111111111011001100110
dcacbbddddbcbcbc
11100010010111111111011001101001
dcacbbddddbcbccb
11100010010111111111011010010110
dcacbbddddbccbbc
11100010010111111111011010011001
dcacbbddddbccbcb
11100010010111111111011010100101
dcacbbddddbcccbb
11100010010111111111100101011010
dcacbbddddcbbbcc
11100010010111111111100101100110
dcacbbddddcbbcbc
11100010010111111111100101101001
dcacbbddddcbbccb
11100010010111111111100110010110
dcacbbddddcbcbbc
11100010010111111111100110011001
dcacbbddddcbcbcb
11100010010111111111100110100101
dcacbbddddcbccbb
11100010010111111111101001010110
dcacbbddddccbbbc
11100010010111111111101001011001
dcacbbddddccbbcb
11100010010111111111101001100101
dcacbbddddccbcbb
11100010010111111111101010010101
dcacbbddddcccbbb
WVUPMOABCDEFGXYNHLKQRSTJIZ

WVUPMOABCDEFGXYNHLKQRSTZIJ

WVUPMOABCDEFGXYNJLKQRSTHIZ

WVUPMOABCDEFGXYNJLKQRSTZIH

WVUPMOABCDEFGXYNZLKQRSTHIJ

WVUPMOABCDEFGXYNZLKQRSTJIH


Code:

#!/usr/bin/python

import sys
from itertools import permutations
#WVUPMOABCDEFGXY??LKQRST?I?

#solString = "WVUPMOABCDEFGXYZNLKQRSTJIH"
keyLength=16
sol=[]
al=[]
ar=[]

def solInit(solString):
         sol=[c for c in solString]
         al=[c for c in "ABCDEFGHIJKLM"]
         ar=[c for c in "NOPQRSTUVWXYZ"]
         return (sol,al,ar)

#Run a recursion over all steps of the algorithm that might lead to the 
correct solution
def possibleSteps(key, al, ar, ctr):
         if (ctr < keyLength):
                 for i1 in range(0,2):
                         for i2 in range(0,2):
                                 (bl, br) = round(i1, i2, al, ar)
                                 if ( 
("".join(sol).find("".join(bl)[:2]) != -1) and 
("".join(sol).find("".join(br)[-2:]) != -1) ):
                                         possibleSteps(key + str(i1) + 
str(i2), bl, br, ctr+1)
         else:
                 if (("".join(al)+"".join(ar)) == "".join(sol)):
                         print key #key in binary

                         #Make key into 4 readable letters
                         key2=""
                         while (len(key) > 0):
                                 if (key[:2] == "00"):
                                         key2 = key2 + "a"
                                 elif (key[:2] == "01"):
                                         key2 = key2 + "b"
                                 elif (key[:2] == "10"):
                                         key2 = key2 + "c"
                                 elif (key[:2] == "11"):
                                         key2 = key2 + "d"
                                 key=key[2:]

                         print key2
         return



def round(n1, n2, al, ar):
         cl = al[:]
         cr = ar[:]
         if n1%2 == 0:
                 ta=cl.pop() # take from left list
         else:
                 ta=cr[0] # take from right list
                 cr=cr[1:]
         #if (n/2)%2 == j:
         if n2%2 == 1:
                 cr.append(ta) # append to right list
         else:
                 cl.insert(0,ta) # insert in left list
         return (cl,cr)



for i in permutations(['H','J','Z','N']):
         solString = "WVUPMOABCDEFGXY"+i[0]+i[1]+"LKQRST"+i[2]+"I"+i[3]
         print solString
         (sol,al,ar) = solInit(solString)
         print

         possibleSteps("", al, ar, 0)



Ozz


Back to sci.crypt | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Toy cipher I made for a reddit challenge Leo <usenet@gkbrk.com> - 2021-09-27 21:15 +0000
  Re: Toy cipher I made for a reddit challenge Richard Heathfield <rjh@cpax.org.uk> - 2021-09-27 23:12 +0100
    Re: Toy cipher I made for a reddit challenge Leo <usenet@gkbrk.com> - 2021-09-27 22:32 +0000
    Re: Toy cipher I made for a reddit challenge Max <maxturv26@gmx.net> - 2021-09-28 00:51 +0200
      Re: Toy cipher I made for a reddit challenge Leo <usenet@gkbrk.com> - 2021-09-28 04:04 -0500
        Re: Toy cipher I made for a reddit challenge Richard Heathfield <rjh@cpax.org.uk> - 2021-09-28 11:29 +0100
        Re: Toy cipher I made for a reddit challenge wizzofozz <oxxxxxxxxxxxs@gmail.com> - 2021-09-28 21:11 +0200
          Re: Toy cipher I made for a reddit challenge Max <maxturv26@gmx.net> - 2021-09-29 00:00 +0200
            Re: Toy cipher I made for a reddit challenge wizzofozz <oxxxxxxxxxxxs@gmail.com> - 2021-09-30 23:07 +0200
              Re: Toy cipher I made for a reddit challenge wizzofozz <oxxxxxxxxxxxs@gmail.com> - 2021-10-01 22:29 +0200
                Re: Toy cipher I made for a reddit challenge Max <maxturv26@gmx.net> - 2021-10-02 04:20 +0200
                Re: Toy cipher I made for a reddit challenge Max <maxturv26@gmx.net> - 2021-10-02 12:18 +0200
                Re: Toy cipher I made for a reddit challenge wizzofozz <oxxxxxxxxxxxs@gmail.com> - 2021-10-02 13:28 +0200
                Re: Toy cipher I made for a reddit challenge Max <maxturv26@gmx.net> - 2021-10-02 16:25 +0200
                Re: Toy cipher I made for a reddit challenge wizzofozz <oxxxxxxxxxxxs@gmail.com> - 2021-10-02 17:25 +0200
                Re: Toy cipher I made for a reddit challenge wizzofozz <oxxxxxxxxxxxs@gmail.com> - 2021-10-02 12:28 +0200
                Re: Toy cipher I made for a reddit challenge Leo <usenet@gkbrk.com> - 2021-10-02 10:42 -0500
                Re: Toy cipher I made for a reddit challenge Max <maxturv26@gmx.net> - 2021-10-02 18:13 +0200
                Re: Toy cipher I made for a reddit challenge wizzofozz <oxxxxxxxxxxxs@gmail.com> - 2021-10-03 12:27 +0200
                Re: Toy cipher I made for a reddit challenge Max <maxturv26@gmx.net> - 2021-10-03 18:02 +0200
                Re: Toy cipher I made for a reddit challenge Stefan Claas <spam.trap.usenet@gmail.com> - 2021-10-03 09:23 -0700
                Re: Toy cipher I made for a reddit challenge wizzofozz <oxxxxxxxxxxxs@gmail.com> - 2021-10-03 21:32 +0200
                Re: Toy cipher I made for a reddit challenge wizzofozz <oxxxxxxxxxxxs@gmail.com> - 2021-10-18 08:52 +0200
                Re: Toy cipher I made for a reddit challenge wizzofozz <oxxxxxxxxxxxs@gmail.com> - 2021-10-18 19:24 +0200
                Re: Toy cipher I made for a reddit challenge Max <maxturv26@gmx.net> - 2021-10-19 00:47 +0200
            Re: Toy cipher I made for a reddit challenge wizzofozz <oxxxxxxxxxxxs@gmail.com> - 2021-10-17 17:17 +0200
              Re: Toy cipher I made for a reddit challenge Max <maxturv26@gmx.net> - 2021-10-17 20:05 +0200
                Re: Toy cipher I made for a reddit challenge Leo <usenet@gkbrk.com> - 2021-10-25 17:18 -0500
                Re: Toy cipher I made for a reddit challenge Max <maxturv26@gmx.net> - 2021-10-26 20:03 +0200
                Re: Toy cipher I made for a reddit challenge wizzofozz <oxxxxxxxxxxxs@gmail.com> - 2021-10-27 19:49 +0200
                Re: Toy cipher I made for a reddit challenge Leo <usenet@gkbrk.com> - 2021-10-27 17:15 -0500
                Re: Toy cipher I made for a reddit challenge Max <maxturv26@gmx.net> - 2021-10-28 12:51 +0200
                Re: Toy cipher I made for a reddit challenge wizzofozz <oxxxxxxxxxxxs@gmail.com> - 2021-10-28 13:33 +0200
                Re: Toy cipher I made for a reddit challenge wizzofozz <oxxxxxxxxxxxs@gmail.com> - 2021-10-31 22:17 +0100
                Re: Toy cipher I made for a reddit challenge Richard Heathfield <rjh@cpax.org.uk> - 2021-10-31 22:38 +0000
                Re: Toy cipher I made for a reddit challenge Leo <usenet@gkbrk.com> - 2021-10-31 18:42 -0500
                Re: Toy cipher I made for a reddit challenge "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2021-10-31 19:30 -0700
                Re: Toy cipher I made for a reddit challenge wizzofozz <oxxxxxxxxxxxs@gmail.com> - 2021-11-01 21:40 +0100

csiph-web