icza / scelight

The source code of the Scelight project with all its modules.
https://sites.google.com/site/scelight/
Apache License 2.0
123 stars 19 forks source link

dev-skill-level-ticket Question not sufficiently comprehensive #33

Closed Stefan-Kosker closed 1 year ago

Stefan-Kosker commented 1 year ago

So I am a dev for a decade and I have a huge problem understanding the task.

Here is the task you want to see:

So the way to do is: the decimal representation of the max value of an 8-byte signed integer = 127 of the SHA-256 checksum = 922c7954216ccfe7a61def609305ce1dc7c67e225f873f256d30d7a8ee4f404c hexadecimal representation ??? SHA-256 is already in 0x Form? Let's assume, it is 8bit char and convert from ASCII to Hexadecimal = 39323263373935343231366363666537613631646566363039333035636531646337633637653232356638373366323536643330643761386565346634303463 Shift right by a value of 0x1a : 3232633739353432313663636665376136316465663630393330356365316463376336376532323566383733663235366433306437613865653466343034631a Hex Value of "CafeBabe" = 43 61 66 65 42 61 62 65 Xored Value = 39323263373935343231366363666537613631646566363039333035636531646337633637653232356638373366323536643330643761382604520376515606

No need to say, it didn't worked. I am pretty sure, I understand something wrong with the task... I enjoyed the task really much but it is kinda frustrating because I guess it is a comprehension issue. It is like an escape room, where the task is hard or challenging, it is just not comprehensible :D

Thank you for your assistance

icza commented 1 year ago

the decimal representation of the max value of an 8-byte signed integer

127 is the max value of an 8-bit signed integer, not that of an 8-byte signed integer.

Also the SHA-256 checksum is binary data, when you say it's 922c7954216ccfe7a61def609305ce1dc7c67e225f873f256d30d7a8ee4f404c, this is already in hex representation, no need to do further ASCII kung fu on it.

Keep trying. Let me know if you got stuck again.

Stefan-Kosker commented 1 year ago

Oh haha thought so, it was something wrong with understanding the task.

So, 8 Byte max number = 9223372036854775807 SHA-256 (0x) = b34a1c30a715f6bf8b7243afa7fab883ce3612b7231716bdcbbdc1982e1aed29 Right Shift by 26 bits (0x1a) = 2cd2870c29c57dafe2dc90eb (or is here you are asking for push 1a from left? So result being 1ab34a1c30a715f6bf8b7243afa7fab883ce3612b7231716bdcbbdc1982e1aed XOR with 4361666542616265 (CafeBabe ASCII to Hexadecimal) = 2cd2870c6aa41bcaa0bdf28e

Which is again wrong. What am I doing wrong?

icza commented 1 year ago

The shifting and XORing have to be done on the number, before calculating the SHA-256.

icza commented 1 year ago

And CafeBabe is already the hex number you have to use, again, no further ASCII kung fu required.

Stefan-Kosker commented 1 year ago

Allright, So, lets start again:

8Byte max number = FF FF FF FF FF FF FF FF 26 bits right shift = 07 FF FF FF Xor This with CAFEBABE = CD014541 To Decimal = 3439412545 SHA-256 = (number as string) 1c003dbf49c4a4e8435813890293114a1b32a1512e8a39e0b967e430b8783604 (number as number) ed5969025b8938edc8c1b180bdeacee78421d6b93e794022f524f38c38ec1041

both not working.

Stefan-Kosker commented 1 year ago

(this is starting to be fun not gonna lie 😀)

icza commented 1 year ago

The initial number must be signed, not unsigned.

Stefan-Kosker commented 1 year ago

8Byte max number = 7F FF FF FF FF FF FF FF 26 bits right shift = 00 01 FF FF FF FF FF FF Xor This with CAFEBABE = 1FFFF35014541 To Decimal = 562946547729729 SHA-256 = (number as string) 0e18400b08f8d4d5a3d8f9af8a10d3054db48bed2adcf22b2c595348f16078fc (number as number) b38461cae06691b8e6fa7b1756c3e2ff26fdb5968bb83dd852d7f8fb1654e0d3

What is missing?

I think I did a mistake at bitwise shift right. Gotta go now

icza commented 1 year ago

Yeah, that shift seems off by like 12 bits...

Stefan-Kosker commented 1 year ago

Edit : Done

icza commented 1 year ago

Yes, your (number as string) solution is the correct one! This was already asked on StackOverflow (how to solve this), and I've answered that question: https://stackoverflow.com/questions/32685574/trying-to-open-developer-options-with-small-coding-test/32708433#32708433

The workspace folder is not the folder where you unpacked Scelight to. The workspace folder holds the persistent state of Scelight (settings, logs, cached data etc.).

Go to Settings, and check the Help on the Workspace node:

image

Stefan-Kosker commented 1 year ago

image It is already set up though... Let me check all, this might be a bug.

Edit: Oh lol a folder named workspace is needed in application folder :D Still not working in there though.

image

Stefan-Kosker commented 1 year ago

Ok anyways activated. You want me to delete the result codes?

icza commented 1 year ago

What did you have to do to make it work? Yes, you can remove the correct result.

Stefan-Kosker commented 1 year ago

What did you have to do to make it work? Yes, you can remove the correct result.

It appears, if you change your workspace and close the application without applying, it doesn't save it haha.

Creating a PR for more comprehensive help. Consider merging it or not :)