Test. The c source code is as follows:
//========================================, using the algorithm of TEA only scroll password function========================================================================================================================
# define mSecDataTempPd 0 x5aa555aa
Const DWORD coSecDataTempPd=(mSecDataTempPd ^ 0 x9e3779b9);
Const DWORD coKeyTempPd []={xa7469115 x126f2e1b 0, 0 xd1ef3da9, 0, 0 x6d83ea82};
/* -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
PData_fGet1TimePd management password (input), 6-12, unsigned character array, the array length 12 bytes, two mechanisms, for example, the password is 123456, then input for {0 x01, 0 x02, 0 x03, 0 x04, 0 x05, 0 x06, 0 XFF, 0 XFF, 0 XFF, 0 XFF, 0 XFF, 0 XFF}
DTime_fGet1TimePd time to January 1, 1970 0 0 0 seconds to the current time, the experience on the number of seconds, unsigned long variable
PPd_fGet1TimePd temporary password, output, unsigned character array, 8 bytes in length, binary,
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- */
Void fGet1TimePd (BYTE * pData_fGet1TimePd dwords dTime_fGet1TimePd, BYTE * pPd_fGet1TimePd)
{
DWORD dData_fGet1TimePd [2].
BYTE * pTemp_fGet1TimePd=(BYTE *) dData_fGet1TimePd;
BYTE bTemp_fGet1TimePd;
DTime_fGet1TimePd/=_TempPdCyc_;
For (bTemp_fGet1TimePd=0; BTemp_fGet1TimePd & lt; 8; BTemp_fGet1TimePd + +)
{
If (bTemp_fGet1TimePd & lt; 6)
{
PTemp_fGet1TimePd [bTemp_fGet1TimePd]=((pData_fGet1TimePd [bTemp_fGet1TimePd * 2] <4) & amp; 0 xf0) | (pData_fGet1TimePd [bTemp_fGet1TimePd * 2 + 1] & amp; 0 x0f);
}
The else
{
PTemp_fGet1TimePd [bTemp_fGet1TimePd]=0;
}
If (bTemp_fGet1TimePd & gt; 3)
{
PTemp_fGet1TimePd [bTemp_fGet1TimePd] ^=(dTime_fGet1TimePd & gt;> ((7 - bTemp_fGet1TimePd) * 8));
}
}
FEncryptTea (& amp; DData_fGet1TimePd [0], & amp; DData_fGet1TimePd [1]).
For (bTemp_fGet1TimePd=0; BTemp_fGet1TimePd & lt; 8; BTemp_fGet1TimePd + +)
{
PPd_fGet1TimePd [bTemp_fGet1TimePd]=(((pTemp_fGet1TimePd [bTemp_fGet1TimePd] & gt;> 4) & amp; 0 x0f) ^ (pTemp_fGet1TimePd [bTemp_fGet1TimePd] & amp; 0 x0f)) % 10;
}
}
Void fEncryptTea (DWORD * fData1_fEncryptTea, dwords * fData2_fEncryptTea)
{
DWORD dTemp1_fEncryptTea=* fData1_fEncryptTea;
DWORD dTemp2_fEncryptTea=* fData2_fEncryptTea;
DWORD dSum_fEncryptTea=0;
DWORD dDelta_fEncryptTea=coSecDataTempPd ^ mSecDataTempPd;
BYTE bTemp_fEncryptTea;
For (bTemp_fEncryptTea=0; BTemp_fEncryptTea & lt; 8; BTemp_fEncryptTea + +)//8 rounds of operations (need corresponding decryption of the core functions of round number as below)
{
DSum_fEncryptTea +=dDelta_fEncryptTea;
DTemp1_fEncryptTea +=((dTemp2_fEncryptTea & lt; <4) + coKeyTempPd [0]) ^ (dTemp2_fEncryptTea + dSum_fEncryptTea) ^ ((dTemp2_fEncryptTea & gt;> 5) + coKeyTempPd [1]);
DTemp2_fEncryptTea +=((dTemp1_fEncryptTea & lt; <4) + coKeyTempPd [2]) ^ (dTemp1_fEncryptTea + dSum_fEncryptTea) ^ ((dTemp1_fEncryptTea & gt;> 5) + coKeyTempPd [3]);
}
FData1_fEncryptTea [0]=dTemp1_fEncryptTea;
FData2_fEncryptTea [0]=dTemp2_fEncryptTea;
}
Test. H source code is as follows:
# # ifndef _tea_h_
# define _tea_h_
15 * 60 # define _TempPdCyc_ (l)//(local) dynamic password cycle parameters, each time change over the cycle, the dynamic password change a, this parameter in seconds, (15 x60) said 900 s (15 minutes),
Void fEncryptTea (DWORD * fData1_fEncryptTea, dwords * fData2_fEncryptTea);
Void fDecryptTea (DWORD * fData1_fDecryptTea, dwords * fData2_fDecryptTea);
# endif
Algorithms for the calculation of is all the code above, please master into in WeChat small programs can use the language, online, etc., all sent,
CodePudding user response:
No one will be? Hurry!CodePudding user response:
Online etc.! I wait, wait, wait, and so onCodePudding user response:
Online said Mandreel tools can automatic conversion, where to download this tool? Looking for half a day also can not find,CodePudding user response:
The c language program can be written directly. Js file, js support c all operations, differences in c & gt;> Js to change & gt;> The unsigned right shift in unsigned char js to go digital & amp; 0 XFF the rest are all the sameCodePudding user response:
I these days is to use a algorithm of C file into the small program all the jS file, the biggest problem is jS during calculation of large overflow after the problem of inaccurate reaches a certain value of jS not accurate is wrong with bignumber jS library can solve most problemsCodePudding user response:
Which file to change? Is to modify the c language source code, or to modify after emcc compiled to javascript code,//add c
#include
#include
#include
Unsigned int LunarCalendarDay;
Unsigned int LunarCalendarTable [199]=
{
X5526bd x04ae53 0, 0 x0a5748, 0, 0, x0d2650 x0d9544 0, 0 x46aab9, 0 x056a4d, 0 x09ad42, 0 x24aeb6, 0 x04ae4a,/* */1901-1910
nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull