right key calculation?
Moderator: Moderators
right key calculation?
Hello,
can someone check, if my key is calculated right?
Lock: testlock
Key: 97 11 61 70 81 30 C0 80 (Hex values)
after I send the key and validatenick to the hub, I get disconnected....
can someone check, if my key is calculated right?
Lock: testlock
Key: 97 11 61 70 81 30 C0 80 (Hex values)
after I send the key and validatenick to the hub, I get disconnected....
-
- Posts: 506
- Joined: 2003-01-03 07:33
Visit http://dcplusplus.sourceforge.net/wiki/ ... /LockToKey where we have several working lock to key programs. You should be able to check with any of those code-examples.
we-love-those-who-help-themself-ly'ers
we-love-those-who-help-themself-ly'ers
Everyone is supposed to download from the hubs, - I don´t know why, but I never do anymore.
-
- Posts: 506
- Joined: 2003-01-03 07:33
-
- Forum Moderator
- Posts: 587
- Joined: 2003-05-07 02:38
- Location: Sweden, Linkoping
-
- Forum Moderator
- Posts: 1420
- Joined: 2003-04-22 14:37
-
- Forum Moderator
- Posts: 587
- Joined: 2003-05-07 02:38
- Location: Sweden, Linkoping
I think
should be replaced with
(This is the values the example is telling to use and the values I use in c++)
Also, I'm not sure that your approatch to load the KeyBytes array works properly but I'm not sure (that approach caused problems for me in c++ but I'm not sure how C# handes it).
Anyway I would suggest to use and eighter initalize the string with " " and then replace that element in the next stage using wathevere function C# has for that or just insert a new character in fron of the string (don't initialize the string to anything if you use this approach). I'm not sure what C# has for function for this eighter but in C++ the first is .replace and the second .insert
Code: Select all
return (byte)(((KeyByte << 4) & 0xF0) | ((KeyByte >> 4) & 0x0F));
Code: Select all
return (byte)(((KeyByte << 4) & 240) | ((KeyByte >> 4) 15));
Also, I'm not sure that your approatch to load the KeyBytes array works properly but I'm not sure (that approach caused problems for me in c++ but I'm not sure how C# handes it).
Anyway I would suggest to use
Code: Select all
KeyBytes += (byte)(LockBytes[i] ^ LockBytes[i - 1]);
-
- Forum Moderator
- Posts: 366
- Joined: 2004-03-06 02:46