EgtLock :
- correzioni a nuova versione mensile valide fino alla 2806 (nella licenza 2201->22, 2202->23 ... 2212->33, 2301->34, 2302->35 ... 2312->45, ...).
This commit is contained in:
+17
-2
@@ -20,6 +20,7 @@
|
||||
#include "LockId.h"
|
||||
#include "Obfuscate.h"
|
||||
#include "/EgtDev/Include/EGnStringUtils.h"
|
||||
#include "/EgtDev/Include/EgtNumUtils.h"
|
||||
#include "/EgtDev/Include/EgtBase64.h"
|
||||
#include "/EgtDev/Include/EgtCrc32.h"
|
||||
#include "/EgtDev/Include/SELkKeyProc.h"
|
||||
@@ -37,13 +38,20 @@ MakeKey( int nProd, int nVer, int nLev, int nExpDays,
|
||||
unsigned int nOpt1, unsigned int nOpt2, int nOptExpDays,
|
||||
const string& sScramKey, string& sKey)
|
||||
{
|
||||
// sistemazioni per nuova versione mensile valide fino alla 2806
|
||||
// ( 2201->22, 2202->23 ... 2212->33, 2301->34, 2302->35 ... 2312->45)
|
||||
if ( nVer > 22 && nVer < 100)
|
||||
return false ;
|
||||
int nVerY = ( nVer >= 100 ? nVer / 100 : nVer) ;
|
||||
int nVerM = ( nVer >= 100 ? Clamp( nVer % 100 - 1, 0, 11) : 0) ;
|
||||
int nVerNew = Clamp( 22 + 12 * ( nVerY - 22) + nVerM, 0, 99) ;
|
||||
// inizializzo parte pseudorandom
|
||||
srand( nVer + nLev) ;
|
||||
srand( nVerNew + nLev) ;
|
||||
// preparo la stringa da criptare
|
||||
string sClearKey ;
|
||||
sClearKey += ToString( ( rand() % 9), 1) ;
|
||||
sClearKey += ToString( nProd, 4) ;
|
||||
sClearKey += ToString( nVer, 2) ;
|
||||
sClearKey += ToString( nVerNew, 2) ;
|
||||
sClearKey += ToString( nLev, 2) ;
|
||||
sClearKey += ToString( ( rand() % 9), 1) ;
|
||||
sClearKey += ToString( nExpDays, 6) ;
|
||||
@@ -104,6 +112,13 @@ ReadKey( const string& sKey, const string& sScramKey,
|
||||
( ((unsigned char)sClearKey[23]) << 16) | ( ((unsigned char)sClearKey[24]) << 24) ;
|
||||
if ( ! FromString( sClearKey.substr( 26, 6), nOptExpDays))
|
||||
return false ;
|
||||
// sistemazioni per nuova versione mensile valide fino alla 2806
|
||||
// ( 2201->22, 2202->23 ... 2212->33, 2301->34, 2302->35 ... 2312->45)
|
||||
if ( nVer > 22) {
|
||||
int nVerY = 22 + ( nVer - 22) / 12 ;
|
||||
int nVerM = nVer - ( 22 + 12 * ( nVerY - 22)) ;
|
||||
nVer = nVerY * 100 + nVerM + 1 ;
|
||||
}
|
||||
return true ;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user