Welcome to HBH! If you have tried to register and didn't get a verification email, please using the following link to resend the verification email.

enc5


ghost's Avatar
0 0

#include <iostream>
using namespace std;

int main (int argc, char * const argv[])
{
    char string[]="PikkJstvh . Gigjmiq{ . 972? . l`kohvk . rqxb";
    int key[]={+8,+4,-1};
    int count=0;
    
    for(int i=0;i<strlen(string);i++)
    {
        if(string[i]!=(char)32)
        {
            string[i]+=key[count];
            count++;
            if(count==sizeof(key)/4) count=0;
        }
    }
    
    cout << string;
    
    return 0;
}```

After i compile it and run it it just gives me jibberish can anyone help me. (this Isn't my code i got it from the code bank and put in the string and key from encryption 5) And i am very new to C++.

thanx :D

ghost's Avatar
0 0

One thing I found with this challenge is the way you look at the key.

Instead of looking at the encryption and doing +8, +4, -1 to them, think of that algorithm already applied to the encryption, so that it would be in reverse.


ghost's Avatar
0 0

hmm.. I tried

int key[]={-8,-4,+1};

instead of

int key[]={+8,+4,-1};

but it still didn't work :( it still comes out as jibberish.???


ghost's Avatar
0 0

yeah your program wont work, bc the pattern doesnt just follow exactly with the key and then repeat. Do it by hand, and its more trial and error, but makes sense in the end


ghost's Avatar
0 0

am I correct in assuming it's a variable key rotational algorithm? I'm using modulus to keep it in between 65 and 122 (a-z, A-Z, []\^_`)

is that correct?

I can send my python to anyone who wants to check it out.


Futility's Avatar
:(
80 122

You don't need a program. Sure, you can use it, but when I did the challenge there were a few discrepancies in the pattern. It'll be easier if you just go through and do it by hand.


ghost's Avatar
0 0

True, only took me about 20 mins by hand, just write out all the things you are looking at in a line, the pattern and its discrepancies will become clear soon enough.


Dunuin's Avatar
Member
0 0

Can someone help me? I think I have got the plaintext but I don't know how to write it right, so the challangeform accepts it. Can I PM someone?


ghost's Avatar
0 0

yeah, u can pm me if u want…


Dunuin's Avatar
Member
0 0

Ok, finished it now.

You have to answer the sentence with spaces and changed/deleted wrong characters.


ghost's Avatar
0 0

glad that u got it! ;)


ghost's Avatar
0 0

So i definitely got this one, but my answer isn't what the challenge is looking for. It's ok… Not panicking, but… I would like to know if can send someone what I have and if they can tell me how to derive the answer the challenge box is looking for.

EDIT: Wow. As soon as I posted this I looked at it again and figured it out. Pretty cool challenge, except for the speelling mistakes, ya?:D