hakatashi / smart-cube-timer

Proof-of-concept smart timer for GiiKER
https://hakatashi.github.io/smart-cube-timer/
MIT License
72 stars 22 forks source link

Latest i3s model (firmware 65) not working #37

Open ragcsalo opened 5 years ago

ragcsalo commented 5 years ago

One of my friends just purchased a Giiker i3s from Amazon, and his cube is not working with custom apps... Firmware version is 65 (my i3s has v39).

The cube seems sending encrypted data after each turn. The following is the normal data we should get for a fully solved cube, after WHITE side was rotated forward 4 times:

1234567833333333123456789abc000041414141

But this new model transmits different data even for the same state... the following 3 should be the same as the above (same state, same last 4 moves):

a1421c1a4759e9af00213cec7026f95e0eb1a70a

a716a8babc44f77eedd70c492ce2218d4744a7f9

4aa65c6109743e77a716a8ba23cdc44b1ce4a771

Maybe they encode the data with the step count as a secret cypher? 🤔

ragcsalo commented 5 years ago

In the meantime I got confirmed that i3S cubes with newer firmware don't work with the v1.2 version of the Supercube app. They must have changed something this year... We should investigate this, otherwise people who get the new cube models won't be able to use custom apps/websites made for Giiker cubes. :-/

hugopeeters commented 5 years ago

Somebody with a background in cryptography should be able this, since you can generate a near infinite set of data and encrypted data.

On 30 Aug 2019, at 08:21, Bence Kovacs notifications@github.com wrote:

In the meantime I got confirmed that i3S cubes with newer firmware don't work with the v1.2 version of the Supercube app. They must have changed something this year... We should investigate this, otherwise people who get the new cube models won't be able to use custom apps/websites made for Giiker cubes. :-/

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/hakatashi/smart-cube-timer/issues/37?email_source=notifications&email_token=AIMFUESUSJGJQZBEPZBFUTTQHC4ANA5CNFSM4ISJL7V2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD5QVYBQ#issuecomment-526474246, or mute the thread https://github.com/notifications/unsubscribe-auth/AIMFUEVSSWNUOH25LTXBXF3QHC4ANANCNFSM4ISJL7VQ.

ragcsalo commented 5 years ago

I will post more status data soon, with the turn count as well... maybe it will help someone to crack it :-)

ragcsalo commented 5 years ago

All these data represent the FULLY SOLVED cube, with WHITE FORWARD as the last 4 turns:

turn count: 2412 status: 706f6936b1edd1b5e00264d099a4e8a19d3ea7f1

turn count: 2416 status: d9f67772c3e9a5ea6e84447abb527156f9dca705

turn count: 2420 status: 37d2e3281f4c85c9194f0434574c773e1ae8a79a

turn count: 2424 status: e44d9d3bd0be4d6301c27d667768e72d1d32a70d

turn count: 2428 status: 37d2e3281f4c85c9194f0434574c773e1ae8a7a9

turn count: 2432 status: 002ba4a414f55f000c7a5cbbc40e3e525ed2a7a1

turn count: 2436 status: 38ead2662019a7097c2db4450a4e40a5adc2a7f5

Regular data (from older firmwares) is like this:

1234567833333333123456789abc000041414141

I hope someone can do something about this! :-)

MartinElsaesser commented 5 years ago

You may wanna look into the cstimer repo, because they managed to decrypt the giiker I3se. As far as I can tell they also use a slightly diffrent approach when it comes to connecting. The link to their giiker.js file is here: Giiker.js file. I hope this helps.

ragcsalo commented 5 years ago

Wooow, thank you very much!!!!! :-) :-) :-) :-)

cartyfox commented 5 years ago

i got today my i3s and want to connect with the hakatashi or pdoronila site but it doesnt work. on bluetooth.cubing.net it works but when i turn the side on the cube the site shows undefinied or ?. i have the gi190048 - thats the bluetooth name. can anyone help please :-S

sonofhypnos commented 5 years ago

I believe the new version of the Giiker cube is called i3SE. I have the same problem as ragcsalo.

cartyfox commented 5 years ago

I have this one: https://www.amazon.de/MIJIA-Giiker-Super-Zauberw%C3%BCrfel-Echtzeit-Synchronisation/dp/B07JN61VGD/ref=mp_s_a_1_1_sspa?keywords=giiker+i3s&qid=1568289409&s=gateway&sr=8-1-spons&psc=1&spLa=ZW5jcnlwdGVkUXVhbGlmaWVyPUExQ085RU41Rlo1NTJTJmVuY3J5cHRlZElkPUEwNzA1NTA0MzBZTUIzMDM5TFFGTCZlbmNyeXB0ZWRBZElkPUEwNDQ3ODY3MkRYR1FEVllHOEQ5TiZ3aWRnZXROYW1lPXNwX3Bob25lX3NlYXJjaF9hdGYmYWN0aW9uPWNsaWNrUmVkaXJlY3QmZG9Ob3RMb2dDbGljaz10cnVl

cartyfox commented 4 years ago

any news why the "new 2019 version" can't connect?

ragcsalo commented 4 years ago

The giiker.js file mentioned above is already removed, but here is the decryption part. Basically it looks for the 18th byte, and if it's A7 then decodes the whole hexa string, which will result in the format of the old versions. Enjoy! :-)

if (raw[18] == 0xa7) { // decrypt
                var key = [176, 81, 104, 224, 86, 137, 237, 119, 38, 26, 193, 161, 210, 126, 150, 81, 93, 13, 236, 249, 89, 235, 88, 24, 113, 81, 214, 131, 130, 199, 2, 169, 39, 165, 171, 41]
                var k1 = raw[19] >> 4 & 0xf;
                var k2 = raw[19] & 0xf;
                for (var i = 0; i < 18; i++) {
                    raw[i] += key[i + k1] + key[i + k2];
                }
                raw = raw.slice(0, 18);
            }
swerder commented 4 years ago

the giiker.js above is renamed to bluetooth.js -> https://github.com/cs0x7f/cstimer/blob/master/src/js/bluetooth.js

kabelbinder commented 4 years ago

I've implemented the decryption part mentioned above in my fork of the bluetooth API that is used for the timer. Feel free to test the compatibility of different versions of the Giiker cube on https://kabelbinder.github.io/smart-cube-timer/ With my Giiker i3SE, it seems to be working fine.

ragcsalo commented 4 years ago

Last year we managed to work with firmware 65, but it seems that now Giiker might have come out with another firmware in April 2020. One of the cubes works with the Supercube app but not with our app... :-(