String manipulation question
#1

Can someone please explain to me what this does? (It seems illogical to me when I try to read it like a python script, I haven't done Pawn in a long time).
Also, this seems to return numbers. Doesn't string[x] return the indexed letter?

Thanks in advance!

Код:
public test(string[])
{
	for(new x=0; x < strlen(string); x++)
	{
		string[x] += (3^x) * (x % 15); //This line specifically

		if(string[x] > (0xff))
		{
			string[x] -= 256;
		}
	}
	return 1;
}
Reply
#2

Lurking and bumping for the explanation, this seems an interesting thread.

Is this some kind of anti spam function? I can't understand shit, I never went to school.
Reply
#3

Well from what i can see it doesn't do anything. It only returns 1 and string is not passed by reference so changes are not saved.

But if we take it as a working function then it looks like some kind of encryption that can be reversed. Actually encryption is a bit strong word, i would rather say string obfuscation.
Reply
#4

Quote:
Originally Posted by DRIFT_HUNTER
Посмотреть сообщение
It only returns 1 and string is not passed by reference so changes are not saved.
Arrays and varargs are always passed by reference
Reply
#5

Could be a conversion for different character sets, target could be ANSI (256 chars, would match - just a guess tho).

The formula may look weird but could be simplified from the original.

EDIT: Scratch that, it's a simple form of encryption.

It just offsets each character by a number calculated from its position. Can be "decrypted" again by doing

Код:
string[x] -= (3^x) * (x % 15);

if(string[x] < 0) string[x] += 256;
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)