I have picked 2 words and encoded them using a secret cipher.
cater > dbuf6XP10PIde1555
reactor > sfbf5XQ10PIde1557
I will provide up to 3 other words encoded with the same cipher, if asked for by traders. (I'll wait on there being a consensus that another example is wanted, I won't just do it in response to the first request.)
Your job is to figure out the full cipher. If anyone posts the solution before close, the market resolves to YES. Otherwise it resolves to NO.
My apologies for abandoning this market. Shall we try again?
https://manifold.markets/IsaacKing/will-anyone-post-a-solution-to-the-fbbb6892d5e9
@JonathanRay i think the first 3 letters are just rot 1 of the input strings
cat -> dbu
rea -> sfb
I agree with the last digit
This might be asking too much info, but is it a rolling cipher in the sense that
Manifold
And
Manifolds
Would result in the first X characters of the cipher text being the same, only being different the last few chars, or similar to a hash, would adding a single letter to the end affect the entire cipher?
@higherLEVELING Let's stick with one at a time. More exciting that way.
Also, people probably want to pick words that will give them maximum information, not just use my picks.
For the purpose of clarification is this market not asking to decipher anything, but rather to find the undisclosed custome algorithm?
It seems to me that the answer space is infinite much in the same way that there are arbitrarily many polynomials which can fit any set of coordinates. For an answer to be well defined additional constraints would need to be imposed rather than additional examples. For example not just a polynomial which passes through {(0,1), (1,2), (3,0)} but specifically the polynomial of least degree which does so, with a coeficent of 1 on the highest degree term.
@IsaacKing I dont think it would come to this, but theoretically it could require that you post every single word that you can think of, so there could be an issue with moving goal posts. If you post a sha256 hash of the "one sentence description" it will serve as a backstop against any concern that the goal posts are moving given the high (infinite) degree of freedom which the stated criteria allow for.
- Shift the first letter by one letter in the alphabet.
- Replace the second letter by the number of letters in the word.
- Replace the last letter by the ASCII code of that letter.
- Shift the rest of the letters by a number of positions in the alphabet that is equal to the second letter minus one.
For example, if the word is hello, then:
- Shift the first letter by one letter in the alphabet: i
- Replace the second letter by the number of letters in the word: 5
- Replace the last letter by the ASCII code of that letter: 111
- Shift the rest of the letters by a number of positions in the alphabet that is equal to the second letter minus one: 5 - 1 = 4. So e becomes i and l becomes p.
- The final cipher is i5ip111.
@Harry_ first 3 are the first 3 of the plaintext rot 1 (cat -> dbu, rea -> sfb) and last character is the length
@Harry_
def cipher(word):
answer = ""
for i in word[0:3]:
answer += chr((ord(i) - 97 + 1) % 26 + 97)
# get number of unique letters
answer += str(hex(251 - len(set(word)))).replace("0x", "")
answer += "X"
if word[0] == "c":
answer += "P"
else:
answer += "Q"
answer += "10PIde155" + str(len(word))
return answer
works for both examples
>>> cipher("cater")
'dbuf6XP10PIde1555'
>>> cipher("reactor")
'sfbf5XQ10PIde1557'
@vincentpearce good spot added that
def shift(char, amount):
return chr((ord(char) - 97 + amount) % 26 + 97)
def cipher(word):
answer = ""
# first 3 letters 1 shift
for i in word[0:3]:
answer += shift(i, 1)
# 4th letter shift by amount of letters - 3 (amount of remaining letters)
answer += shift(word[3], len(word) - 1 - 3)
# 11 - length of unique chars
answer += str(11 - len(set(word)))
answer += "X"
# not sure about the P and Q
if word[0] == "c":
answer += "P"
else:
answer += "Q"
# seems to be fixed? could be related to reactor and cater
# last char seems to be length of word
answer += "10PIde155" + str(len(word))
return answer
works for both examples
>>> cipher("cater")
'dbuf6XP10PIde1555'
>>> cipher("reactor")
'sfbf5XQ10PIde1557'
The cipher is as follows:
```
>>> def cipher(input):
... length = random.randint(1,30)
... return ''.join([random.choice(['d', 'b', 'u', 'f', '6', 'X', 'P', '1', '0', 'Plde', '1', '5', '7', 's', 'Q']) fo
r _ in range(length)])
...
>>> cipher('cater')
'dbuf6XP10PIde1555'
>>> cipher('reactor')
'sfbf5XQ10PIde1557'
```
To say the same with less satire, some more "ground rules" would be nice here. Does every plaintext cipher to exactly one ciphertext and vice versa? Is there a length limit for this cipher? Are you fairly confident it can be solved given only two examples, and the solution will be fairly obviously correct once discovered?
@Shelvacu Every plaintext maps to a single ciphertext, yes. It's not necessarily bijective though.
Not particularly confident it can be solved with only 2, which is why I built in the option of asking for more.
I don't know how obvious it will be, but it's not particularly complicated. I can describe it in one sentence.
@IsaacKing
def cipher(input):
return 'dbuf6XP10PIde1555' if cipher == 'cater' else 'sfbf5XQ10PIde1557'
unit tests pass, ship it