mirror of https://github.com/rusefi/UnlockECU.git
Introduce seed key for EGS53
This commit is contained in:
parent
7651faac72
commit
f675456c0b
|
@ -0,0 +1,35 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace UnlockECU
|
||||
{
|
||||
/// <summary>
|
||||
/// Implementation of extended VGS Algo with different keys for multiplication and xor
|
||||
/// </summary>
|
||||
class VGSSecurityAlgoExt : SecurityProvider
|
||||
{
|
||||
public override bool GenerateKey(byte[] inSeed, byte[] outKey, int accessLevel, List<Parameter> parameters)
|
||||
{
|
||||
byte[] cryptoKeyMultBytes = GetParameterBytearray(parameters, "M");
|
||||
uint cryptoKeyMult = BytesToInt(cryptoKeyMultBytes, Endian.Big);
|
||||
|
||||
byte[] cryptoKeyXorBytes = GetParameterBytearray(parameters, "X");
|
||||
uint cryptoKeyXor = BytesToInt(cryptoKeyXorBytes, Endian.Big);
|
||||
|
||||
if ((inSeed.Length != 4) || (outKey.Length != 4))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
long seed = BytesToInt(inSeed, Endian.Big);
|
||||
long seedKey = cryptoKeyMult * (cryptoKeyXor ^ seed);
|
||||
|
||||
IntToBytes((uint)seedKey, outKey, Endian.Big);
|
||||
return true;
|
||||
}
|
||||
public override string GetProviderName()
|
||||
{
|
||||
return "VGSSecurityAlgoExt";
|
||||
}
|
||||
}
|
||||
}
|
|
@ -11818,6 +11818,27 @@
|
|||
"DataType": "ByteArray"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"EcuName": "EGS53",
|
||||
"Aliases": [],
|
||||
"AccessLevel": 1,
|
||||
"SeedLength": 4,
|
||||
"KeyLength": 4,
|
||||
"Provider": "VGSSecurityAlgoExt",
|
||||
"Origin": "EGS53_27_05@VladLupashevskyi-@rnd-ash",
|
||||
"Parameters": [
|
||||
{
|
||||
"Key": "X",
|
||||
"Value": "6BB6B6B6",
|
||||
"DataType": "ByteArray"
|
||||
},
|
||||
{
|
||||
"Key": "M",
|
||||
"Value": "49949494",
|
||||
"DataType": "ByteArray"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"EcuName": "Subaru_2EE2",
|
||||
|
|
Loading…
Reference in New Issue