Skip to content

Commit bbfbca4

Browse files
authored
Refactor GenerateKey method output handling
Updated the GenerateKey method to use string formatting for output as Binary Coded Decimal, Result is a ready Code, no further operations required
1 parent 7d0359c commit bbfbca4

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

UnlockECU/UnlockECU/Security/RenaultRadio.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,10 @@ public override bool GenerateKey(byte[] inSeed, byte[] outKey, int accessLevel,
5555
if (outKey.Length < 2)
5656
return false;
5757

58-
outKey[0] = (byte)((eax >> 8) & 0xFF);
59-
outKey[1] = (byte)(eax & 0xFF);
58+
string s = eax.ToString("D4"); //
59+
60+
outKey[0] = (byte)(((s[0] - '0') << 4) | (s[1] - '0'));
61+
outKey[1] = (byte)(((s[2] - '0') << 4) | (s[3] - '0'));
6062

6163
return true;
6264
}

0 commit comments

Comments
 (0)