Anonymous
Hey guys, i need help, who can translate this code from c# to c++ ?
klimi
Dunno
Anonymous
(
Anonymous
public static byte[] XORDecrypt(byte[] encoded, string Key) { byte[] key = Encoding.ASCII.GetBytes(Key); for (int i = 0; i < encoded.Length; i++) encoded[i] ^= (byte)(key[i % key.Length] >> (i + key.Length) & 255); return encoded; }
klimi
But I think I can do it ... I think I can do your work myself
klimi
You sure you can't do it yourself?
Anonymous
I don't understand anything in c++ but I urgently need this code
Dima
no one is gotta do this.
Anonymous
all my attempts are in vain
klimi
all my attempts are in vain
I'm sorry null but I can't do it...
Anonymous
no one is gotta do this.
if u want not do this u can keep an opinion
Dima
why would you need exactly this c# code, while there are done xor examples for c++, like this https://kylewbanks.com/blog/Simple-XOR-Encryption-Decryption-in-Cpp
klimi
:(
Its forbidden
BinaryByter
int a = 2; char b = a; At the second line, is type of b converted to an int ?
dont think too much about types. in such cases, the value of the car is just put intk the int
BinaryByter
cpp is FAR less type secure than you might think
Lucifer
Hye
Anonymous
ascii values are numbers
Yeah for (int I = 0; I <= 255; I++) printf("%d = %c", I, I);
Anonymous
Need alternative for if operator Anyone knows except '?' operator
Nikolas
why do you need "alternatives" to the if operator?
Nikolas
(which is not an operator to be precise)
BinaryByter
🙃
Anonymous
asm ("cmp a, b");
?? Can u plz giv example?
BinaryByter
Im practicing the organ
BinaryByter
so no
BinaryByter
Im sure that Dima would love to help you out with cmp though!
Dima
use strcmp
Anonymous
use strcmp
Can it be used for int?
BinaryByter
of course it can
BinaryByter
if you know how computers work 😏
BinaryByter
Yea?
BinaryByter
just typecast the int to a char*
BinaryByter
well you might need a char after the ind for null termination 😂😂
BinaryByter
you are fired.
It works though 😏😏😂😂😂😂
luke
It works though 😏😏😂😂😂😂
Got yourself into a trap,ye?
BinaryByter
Come on, max!!
Do you know how strcmp works?
BinaryByter
BinaryByter
Yea
So where is the problem with feeding it the pointer to an int>
BinaryByter
I answered his question of 'does it work with ints'
BinaryByter
Didnt say you should use that
BinaryByter
😂😂😂😂
luke
Anonymous
strcmp compares each char in a string
Anonymous
and each char is stored as an ASCII
Anonymous
So it's comparing numbers in the end.
Anonymous
😂btw it's not !false
luke
So it's comparing numbers in the end.
Yea like 0-9 not numbers like 1000 or something
Anonymous
In ASCII
luke
0 is 30
I know ASCII to the required extent.
Anonymous
And 9 is 39
Anonymous
Ever tried 65 - 'A';
BinaryByter
0 is 30
30 in hex 😘
BinaryByter
Anonymous
30 in hex 😘
Shit I forgot😂
Anonymous
It's 48 in ASCII
BinaryByter
No!!!
thats what eof checks for in pascal
BinaryByter
Well not really
BinaryByter
but basically
Anonymous
printf("%d", 65 - 'A');
luke
Hehehehhe You turned your argument against yourself!!
Anonymous
Never tried it though
luke