Swara
Yes tell
/
how can i store something like this 0x36171D9755905E2D1BB86482756D5E00 in a char *
/
Yes tell
i mean set the bytes it points to that
/
without creating many arrays
/
and split it
/
Yes tell
do you know
Daulet
Current variant
/
Current variant
i mean something like *bytes = 0x36171D9755905E2D1BB86482756D5E00
/
How it like
do you know
/
help
/
what do you want to do
store like a string of bytes in a char *
Ehsan
0x36171D9755905E2D1BB86482756D5E00
Ehsan
is this a number? or you want to store each byte?
Ehsan
what are you trying to accomplish exactly =-=?
Daulet
store each byte
char bytes[] = {0x36, 0x17, 0x1D, 0x97, 0x55, 0x90, 0x5E, 0x2D, 0x1B, 0xB8, 0x64, 0x82, 0x75, 0x6D, 0x5E, 0x00};
/
but how i do it without copying manually
Daulet
you mean with cast?
Daulet
Then how
/
0x36171D9755905E2D1BB86482756D5E00
create a byte array from this without having to copy each byte
Daulet
create a byte array from this without having to copy each byte
compiler doesnt support 128bit number initialization
Daulet
import sys num = 0x36171D9755905E2D1BB86482756D5E00 some_bytes = num.to_bytes(16, sys.byteorder) bytearr = bytearray(some_bytes) for byte in bytearr[::-1]: print(hex(byte))
Ehsan
that takes it as a string and process each byte
Ehsan
I don't know if C has a big int library though
Daulet
in C you do everything yourself dummy
Faster way to use python. builtin bigint support
Ehsan
Faster way to use python. builtin bigint support
even Java and C# and almost all modern languages
Ehsan
except C and C++
Daulet
yes
Yes
/
Yes
i try doing it in python
/
Ok
yes
/
Yes
i have a problem
/
wait maybe i have not
Daulet
i have a problem
What's the problem
/
What's the problem
i have solved the problem
Dima
what is goin on lol
/
Good
thank you
/
Good
how i convert a byte array to a string
/
Good
str()
/
Good
ok i have solved
/
Good
but now i have a new problem
Daulet
/
Ok whats happend
i have got rhis bytearray(b'com/maxm\x00\x00\x00\x00\x00\x00\x00\x00')
/
as output
/
Ok whats happend
why it also added the bytearray function to the string
Daulet
"0x36 0x17..."
/
"0x36 0x17..."
you want to see the code
/
com/maxm
like this
Daulet
Then how
/
Then how
you want to see the code
/
Yes
import sys xor_keys = [ 5, 0x12, 0xFA, 0x34, 0xE1, 0x7C, 0x38, 0x5A, 0x61, 0x30, 0xA, 0x5A, 0xD1, 0x10, 0xCA, 0x72, 0x15, 0x51, 0xA5, 0x64, 1, 0x5F, 0x31, 0x41, 0x7A, 0x25, 0x2B, 0x8A, 0x3F, 0x1F, 0x9A ]; def decrypt(string_length, bytes): str_length = string_length & ~(string_length >> 31) counter = 0 while True: key = xor_keys[counter] if counter > 31: counter = 0 bytes[counter] ^= key counter += 1 str_length -= 1 if str_length == 0: break return str(bytes) n = 0x37401D8C1B977D66 length = 8 print(decrypt(length, bytearray(n.to_bytes(16, sys.byteorder))))
/
Yes
you see the code
/
Yes
you understanded it
/
No.
it is an easy code
Daulet
But give me sometime
/
But give me sometime
it decrypts a string
Daulet
it decrypts a string
Is it work correctly?