I'm getting confused on the algorithm

Custom encoding


2

Hello everyone,
I’m getting real confused on the part 2 of the algorithm. Step 1 is kinda clear for everyone I guess
Correct me if i’m wrong :
2.A - The new ascii code value is gotten from step 1
B - this new ascii value is to be substracted from the total number of visible ascii char from step 1
HERE’S THE CONFUSING PART
C - Get the char at this position.
Does it mean that using the result at B, we find the char at that position in the :
1. Original encoded string
2. Re-numbered string
3. The normal ascii table
Either way I’m getting index out of range and also i noticed that from the beginning there’s no letter in the provided string.
Can anyone help/guide me please ?

Thread has been resolved, jump to solution
9replies
4voices
424views
rjkenny
3 years ago

0

How far are you out of the index? 1? ;)


0

It’s wasn’t showing the number but I guess it’s way more than 1. But then instead of doing [total number of visible char] - [new ascii code value] I did [new ascii code value] - [total number of visible char] and now I don’t get the Index out of range.
- I guess the result of that operation gives the position
- I tried that position in the list holding the re-numbered ascii chars and the values are too low to mean anything
- I tried that position on the list holding the original sequence and the values seem fine if I had 32 but it appears just to be a bunch of letters and still making no sense.

I’m so confused right now

rjkenny
3 years ago

2

It sounds like you’re nearly on the right path, just not quite.

My suggestion? Break this into two parts… find a way to get pair of strings, known text and known encoded values, then decode that.


0

I followed your suggestion and wrote a program using a string that I encoded and then decoded. That actually made me think that I had to approach this challenge in the reverse way of the algorithm since that’s what I used to decode.
I came back and applied that method on this challenge but i’m getting some chars and some weird chars as well : [‘\x86’, ‘\x8d’, ‘x’, ‘\x89’, ‘P’, etc ] ?
– HELP –

rjkenny
3 years ago | edited 3 years ago

0

yeah, it sounds like you’re getting closer now. I had a feeling you were trying to encode the already encoded data.

So… you’ve got a bug in your code, or an incorrect implementation of the algorithm.

How to sort it out? If only I (hint) could find a (hint) subtle way to (hint) point you in a (hint) pretty standard way to (hint) solve an (hint) easier part of (hint) this kind of problem.

Reply has been removed

0

@rjkenny Your hint is confusing,
I’m went through it again thinking I may haven’t understood the number of visible ascii char since I was only counting the number of visible ascii char in the given string. So instead I went and counted the total number of visible ascii char in the ascii table, from there the results is less weird but still weird
ex : [‘’, ‘’, ‘}’, ‘’, ‘’, ‘’, ….
I guess the most confusing part is
c : Get the character at this position. Which position ? position in the ascii table or position in the given string ? and then
d : Get its original ascii value …
this is super confusing let’s do this,
suppose I have the letter A which is = 65
after re–number it’s gonna be 33 (so far so good)
Total number of visible in the ascii table = 93 (I guess DEL is invisible)
After subtraction we have 60 now comes the C part
The char at 60 is <
How to use D now that we already see that the char at position 60 is < in the ascii table ?

rjkenny
3 years ago | reply to #80925

0

I’m saying that it’s easiest to start with short known strings for debugging this kind of thing. If you see a single letter word, it’s almost definitely “I” or “a”, two letters “an, "of”, etc I’m sure you did this, I just don’t want to spoil the level for you by giving you too much info. You’re getting pretty close.

I ran into similar issues on this level. I’m not sure if the level description was intentionally vague, but try changing the obvious stuff and maybe try some 5 or 10 minute diversions with changes that you think shouldn’t work.

n0rr
3 years ago

2

HERES THE CONFUSING PART
C - Get the char at this position.
Does it mean that using the result at B, we find the char at that position in the :
1. Original encoded string
2. Re-numbered string
3. The normal ascii table

What you’re asked to do in step 2.c is to get the value from 2.b and find the character in the new ascii table [1-93]. Finally, you have to take this character’s value from the original ascii table[1-127]. For example lets take the character “a”(ascii value - 97) and encode it:

  1. Original ascii value(97) - number of invisible characters(33) = 64 (new ascii value)
  2. Total number of visible characters (93) - new ascii value (64) = 29 (result)
  3. Character at index ‘result’ from our new ascii table: “=”
  4. “=” original ascii value: (29+32) = 61

To build the decoder you just reverse the order of the operations.


1

@n0rr Thanks a bunch, really.
I finally managed to solve it but it was all thanks to you <3
I’m also thanking @rjkenny for making me keep grinding

Discussion thread has been locked. You can no longer add new posts.
1 of 10

This site only uses cookies that are essential for the functionality of this website. Cookies are not used for tracking or marketing purposes.

By using our site, you acknowledge that you have read and understand our Privacy Policy, and Terms of Service.

Dismiss