Telegramy
Articles
About
« Rev
@programminginc
1555
Fwd »
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
Anonymous
You sure you can't do it yourself?
of course
klimi
I don't understand anything in c++ but I urgently need this code
Why is that?
Dima
no one is gotta do this.
Anonymous
all my attempts are in vain
klimi
no one is gotta do this.
No? Oh...
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
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; }
first link -.- https://stackoverflow.com/questions/46948808/c-equivalent-to-c-sharp-encoding-ascii-getbytes
Anonymous
I'm sorry null but I can't do it...
:(
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
BinaryByter
no type casting will not occur it will take as an ASCII value
ascii values are numbers
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
Need alternative for if operator Anyone knows except '?' operator
asm ("cmp a, b");
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
Im sure that Dima would love to help you out with cmp though!
U telling to me?
Anonymous
use strcmp
Can it be used for int?
luke
Can it be used for int?
No
BinaryByter
of course it can
BinaryByter
if you know how computers work 😏
luke
if you know how computers work 😏
Seriously?
BinaryByter
Yea?
BinaryByter
just typecast the int to a char*
Dima
just typecast the int to a char*
you are fired.
luke
just typecast the int to a char*
Come on, max!!
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?
luke
Do you know how strcmp works?
Yea
BinaryByter
Got yourself into a trap,ye?
not really, no
BinaryByter
Yea
So where is the problem with feeding it the pointer to an int>
luke
not really, no
luke
So where is the problem with feeding it the pointer to an int>
Fine, have fun with it then
BinaryByter
I answered his question of 'does it work with ints'
luke
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
luke
😂😂😂😂
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
Yea like 0-9 not numbers like 1000 or something
0 is 30
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
Ever tried 65 - 'A';
END OF FILE
Anonymous
30 in hex 😘
Shit I forgot😂
luke
END OF FILE
No!!!
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
Never tried it though
Go ahead then.
« Rev
@programminginc
1555
Fwd »