mirror of
https://github.com/bitcookies/winrar-keygen.git
synced 2026-04-20 16:12:06 +00:00
🌙 Adapt the Github Dark Theme
🌙 Adapt the Github Dark Theme
This commit is contained in:
parent
9e562aeaba
commit
6a562661cd
2 changed files with 150 additions and 124 deletions
|
|
@ -1,193 +1,238 @@
|
|||
# How is "rarreg.key" generated?
|
||||
|
||||
WinRAR uses an ECC-based signature algorithm to generate `rarreg.key`. The algorithm it used is a variant of Chinese SM2 digital signature algorithm. Different to many standard ECDSAs, the curve that WinRAR selected is a curve over composite field ![GF2p15p17-inlined].
|
||||
WinRAR uses an ECC-based signature algorithm to generate `rarreg.key`. The algorithm it used is a variant of Chinese SM2 digital signature algorithm. Different to many standard ECDSAs, the curve that WinRAR selected is a curve over composite field  .
|
||||
|
||||
## 1. Composite field ![GF2p15p17-inlined]
|
||||
## 1. Composite field  
|
||||
|
||||
Elements in ground field ![GF2p15-inlined] are represented with standard basis, i.e. polynomial basis. The irreducible polynomial is
|
||||
Elements in ground field  are represented with standard basis, i.e. polynomial basis. The irreducible polynomial is
|
||||
|
||||
<p align="center">
|
||||
<img src="http://latex.codecogs.com/svg.latex?P%28%5Calpha%29%3D%5Calpha%5E%7B15%7D+%5Calpha+1")
|
||||
<img src="assets/formula/1-light.svg#gh-light-mode-only">
|
||||
<img src="assets/formula/1-dark.svg#gh-dark-mode-only">
|
||||
</p>
|
||||
|
||||
where each coefficients is in ![GF2-inlined]. If we use
|
||||
|
||||
where each coefficients is in . If we use
|
||||
|
||||
<p align="center">
|
||||
<img src="http://latex.codecogs.com/svg.latex?B_1%3D%5C%7B1%2C%5Calpha%2C%5Calpha%5E2%2C%5Cldots%2C%5Calpha%5E%7B14%7D%5C%7D")
|
||||
<img src="assets/formula/2-light.svg#gh-light-mode-only">
|
||||
<img src="assets/formula/2-dark.svg#gh-dark-mode-only">
|
||||
</p>
|
||||
|
||||
as the standard basis of the ground field, an element ![A-inlined] in ![GF2p15-inlined] can be denoted as
|
||||
|
||||
as the standard basis of the ground field, an element  in  can be denoted as
|
||||
|
||||
<p align="center">
|
||||
<img src="http://latex.codecogs.com/svg.latex?A%3D%5Csum_%7Bi%3D0%7D%5E%7B14%7Da_i%5Calpha%5Ei%20%5Cquad%20%5Cquad%20%5Cquad%20a_i%5Cin%5Ctextrm%7BGF%7D%282%29")
|
||||
<img src="assets/formula/3-light.svg#gh-light-mode-only">
|
||||
<img src="assets/formula/3-dark.svg#gh-dark-mode-only">
|
||||
</p>
|
||||
|
||||
|
||||
---
|
||||
|
||||
The irreducible polynomial of composite field ![GF2p15p17-inlined] is
|
||||
The irreducible polynomial of composite field   is
|
||||
|
||||
<p align="center">
|
||||
<img src="http://latex.codecogs.com/svg.latex?Q%28%5Cbeta%29%3D%5Cbeta%5E%7B17%7D+%5Cbeta%5E3+1")
|
||||
<img src="assets/formula/4-light.svg#gh-light-mode-only">
|
||||
<img src="assets/formula/4-dark.svg#gh-dark-mode-only">
|
||||
</p>
|
||||
|
||||
where each coefficients is in ![GF2p15-inlined]. If we use
|
||||
|
||||
where each coefficients is in . If we use
|
||||
|
||||
<p align="center">
|
||||
<img src="http://latex.codecogs.com/svg.latex?B_2%3D%5C%7B1%2C%5Cbeta%2C%5Cbeta%5E2%2C%5Cldots%2C%5Cbeta%5E%7B16%7D%5C%7D")
|
||||
<img src="assets/formula/5-light.svg#gh-light-mode-only">
|
||||
<img src="assets/formula/5-dark.svg#gh-dark-mode-only">
|
||||
</p>
|
||||
|
||||
as the standard basis of the composite field, an element ![B-inlined] in ![GF2p15p17-inlined] can be denoted as
|
||||
|
||||
as the standard basis of the composite field, an element  in   can be denoted as
|
||||
|
||||
<p align="center">
|
||||
<img src="http://latex.codecogs.com/svg.latex?B%3D%5Csum_%7Bj%3D0%7D%5E%7B16%7D%28%5Csum_%7Bi%3D0%7D%5E%7B14%7Da_%7Bj%2Ci%7D%5Calpha%5Ei%29%5Cbeta%5Ej%3D%5Csum_%7Bj%3D0%7D%5E%7B16%7D%5Csum_%7Bi%3D0%7D%5E%7B14%7Da_%7Bj%2Ci%7D%5Calpha%5Ei%5Cbeta%5Ej%20%5Cquad%20%5Cquad%20%5Cquad%20a_%7Bj%2Ci%7D%5Cin%5Ctextrm%7BGF%7D%282%29")
|
||||
<img src="assets/formula/6-light.svg#gh-light-mode-only">
|
||||
<img src="assets/formula/6-dark.svg#gh-dark-mode-only">
|
||||
</p>
|
||||
|
||||
|
||||
---
|
||||
|
||||
For clarity, we use ![D-inlined], which is a 255-bits-long integer to denote an element ![B-inlined] in ![GF2p15p17-inlined]. The map between them is
|
||||
For clarity, we use  , which is a 255-bits-long integer to denote an element  in  . The map between them is
|
||||
|
||||
<p align="center">
|
||||
<img src="http://latex.codecogs.com/svg.latex?B%3D%5Csum_%7Bj%3D0%7D%5E%7B16%7D%5Csum_%7Bi%3D0%7D%5E%7B14%7Da_%7Bj%2Ci%7D%5Calpha%5Ei%5Cbeta%5Ej%20%5Cleftrightarrow%20D%3D%5Csum_%7Bj%3D0%7D%5E%7B16%7D%5Csum_%7Bi%3D0%7D%5E%7B14%7Da_%7Bj%2Ci%7D%5Ccdot%202%5E%7B15j+i%7D")
|
||||
<img src="assets/formula/7-light.svg#gh-light-mode-only">
|
||||
<img src="assets/formula/7-dark.svg#gh-dark-mode-only">
|
||||
</p>
|
||||
|
||||
## 2. Elliptic curve over ![GF2p15p17-inlined]
|
||||
|
||||
## 2. Elliptic curve over  
|
||||
|
||||
The equation of the elliptic curve that WinRAR uses is
|
||||
|
||||
<p align="center">
|
||||
<img src="http://latex.codecogs.com/svg.latex?y%5E2+xy%3Dx%5E3+161%20%5Cquad%20%5Cquad%20%5Cquad%20161%5Cin%5Ctextrm%7BGF%7D%28%282%5E%7B15%7D%29%5E%7B17%7D%29")
|
||||
<img src="assets/formula/8-light.svg#gh-light-mode-only">
|
||||
<img src="assets/formula/8-dark.svg#gh-dark-mode-only">
|
||||
</p>
|
||||
|
||||
The base point ![G-inlined] is
|
||||
|
||||
The base point  is
|
||||
|
||||
<p align="center">
|
||||
<img src="http://latex.codecogs.com/svg.latex?%5Cbegin%7Baligned%7D%20G%26%3D%28G_x%2CG_y%29%20%5C%5C%20G_x%26%3D%5Ctextrm%7B0x56fdcbc6a27acee0cc2996e0096ae74feb1acf220a2341b898b549440297b8cc%7D%20%5Cquad%20G_x%5Cin%5Ctextrm%7BGF%7D%28%282%5E%7B15%7D%29%5E%7B17%7D%29%5C%5C%20G_y%26%3D%5Ctextrm%7B0x20da32e8afc90b7cf0e76bde44496b4d0794054e6ea60f388682463132f931a7%7D%20%5Cquad%20G_y%5Cin%5Ctextrm%7BGF%7D%28%282%5E%7B15%7D%29%5E%7B17%7D%29%20%5Cend%7Baligned%7D")
|
||||
<img src="assets/formula/9-light.svg#gh-light-mode-only">
|
||||
<img src="assets/formula/9-dark.svg#gh-dark-mode-only">
|
||||
</p>
|
||||
|
||||
whose order ![n-inlined] is
|
||||
|
||||
whose order  is
|
||||
|
||||
<p align="center">
|
||||
<img src="http://latex.codecogs.com/svg.latex?n%3D%5Ctextrm%7B0x1026dd85081b82314691ced9bbec30547840e4bf72d8b5e0d258442bbcd31%7D%20%5Cquad%20n%5Cin%5Cnolinebreak%5Cmathbb%7BZ%7D")
|
||||
<img src="assets/formula/10-light.svg#gh-light-mode-only">
|
||||
<img src="assets/formula/10-dark.svg#gh-dark-mode-only">
|
||||
</p>
|
||||
|
||||
|
||||
## 3. Message hash algorithm
|
||||
|
||||
We use
|
||||
|
||||
<p align="center">
|
||||
<img src="http://latex.codecogs.com/svg.latex?M%3Dm_0m_1%20%5Cldots%20m_%7Bl-1%7D%20%5Cquad%20%5Cquad%20m_i%5Cin%5B0%2C%20256%29")
|
||||
<img src="assets/formula/11-light.svg#gh-light-mode-only">
|
||||
<img src="assets/formula/11-dark.svg#gh-dark-mode-only">
|
||||
</p>
|
||||
|
||||
to denote a message whose length is ![l-inlined]. So the SHA1 value of ![M-inlined] should be
|
||||
|
||||
to denote a message whose length is . So the SHA1 value of  should be
|
||||
|
||||
<p align="center">
|
||||
<img src="http://latex.codecogs.com/svg.latex?%5Ctextrm%7BSHA%7D_1%28M%29%3DS_0%7C%7CS_1%7C%7CS_2%7C%7CS_3%7C%7CS_4%20%5Cquad%20%5Cquad%20S_i%5Cin%5B0%2C%202%5E%7B32%7D%29")
|
||||
<img src="assets/formula/12-light.svg#gh-light-mode-only">
|
||||
<img src="assets/formula/12-dark.svg#gh-dark-mode-only">
|
||||
</p>
|
||||
|
||||
where  are 5 state values when SHA1 outputs. Generally speaking, the final SHA1 value should be the join of these 5 state values while each of state values is serialized in big-endian.
|
||||
|
||||
However, WinRAR doesn't serialize the 5 state values. Instead, it use a big integer ![h-inlined] as the hash of the input message.
|
||||
where  are 5 state values when SHA1 outputs. Generally speaking, the final SHA1 value should be the join of these 5 state values while each of state values is serialized in big-endian.
|
||||
|
||||
However, WinRAR doesn't serialize the 5 state values. Instead, it use a big integer  as the hash of the input message.
|
||||
|
||||
<p align="center">
|
||||
<img src="http://latex.codecogs.com/svg.latex?h%3D%28%5Csum_%7Bi%3D0%7D%5E%7B4%7DS_i%20%5Ccdot%202%5E%7B32i%7D%29+%5Ctextrm%7B0x1bd10xb4e33c7c0ffd8d43%7D%20%5Ccdot%202%5E%7B32*5%7D")
|
||||
<img src="assets/formula/15-light.svg#gh-light-mode-only">
|
||||
<img src="assets/formula/15-dark.svg#gh-dark-mode-only">
|
||||
</p>
|
||||
|
||||
|
||||
## 4. ECC digital signature algorithm
|
||||
|
||||
We use ![k-inlined] to denote private key, ![P-inlined] to denote public key. So there must be
|
||||
We use  to denote private key,  to denote public key. So there must be
|
||||
|
||||
<p align="center">
|
||||
<img src="http://latex.codecogs.com/svg.latex?P%3Dk%20%5Ccdot%20G")
|
||||
<img src="assets/formula/16-light.svg#gh-light-mode-only">
|
||||
<img src="assets/formula/16-dark.svg#gh-dark-mode-only">
|
||||
</p>
|
||||
|
||||
If we use ![h-inlined] to denote the hash of input data, WinRAR use the following algorithm to perform signing:
|
||||
|
||||
1. Generate a random big integer ![Rnd-inlined] which satisfies .
|
||||
If we use  to denote the hash of input data, WinRAR use the following algorithm to perform signing:
|
||||
|
||||
2. Calculate ![r-inlined]
|
||||
1. Generate a random big integer  which satisfies .
|
||||
|
||||
2. Calculate 
|
||||
|
||||
<p align="center">
|
||||
<img src="http://latex.codecogs.com/svg.latex?r%3D%28%28Rnd%20%5Ccdot%20G%29_x+h%29%5C%20%5C%20Mod%5C%20%5C%20n">
|
||||
<img src="assets/formula/19-light.svg#gh-light-mode-only">
|
||||
<img src="assets/formula/19-dark.svg#gh-dark-mode-only">
|
||||
</p>
|
||||
|
||||
where  means we take X coordinate of  and convert it from ![GF2p15p17-inlined] to a big integer.
|
||||
|
||||
If  or , go back to step 1.
|
||||
where  means we take X coordinate of  and convert it from   to a big integer.
|
||||
|
||||
3. Calculate ![s-inlined]
|
||||
If  or , go back to step 1.
|
||||
|
||||
3. Calculate 
|
||||
|
||||
<p align="center">
|
||||
<img src="http://latex.codecogs.com/svg.latex?s%3D%28Rnd-kr%29%5C%20%5C%20Mod%5C%20%5C%20n">
|
||||
<img src="assets/formula/24-light.svg#gh-light-mode-only">
|
||||
<img src="assets/formula/24-dark.svg#gh-dark-mode-only">
|
||||
</p>
|
||||
|
||||
If , go back to step 1.
|
||||
|
||||
4. Output .
|
||||
If , go back to step 1.
|
||||
|
||||
4. Output .
|
||||
|
||||
## 5. WinRAR private key generation algorithm
|
||||
|
||||
We use
|
||||
|
||||
<p align="center">
|
||||
<img src="http://latex.codecogs.com/svg.latex?T%3Dt_0t_1%20%5Cldots%20t_%7Bl-1%7D%20%5Cquad%20%5Cquad%20t_i%5Cin%5B0%2C256%29">
|
||||
<img src="assets/formula/26-light.svg#gh-light-mode-only">
|
||||
<img src="assets/formula/26-dark.svg#gh-dark-mode-only">
|
||||
</p>
|
||||
|
||||
to denote input data whose length is ![l-inlined]. WinRAR use it to generate private key ![k-inlined].
|
||||
|
||||
1. We use  to denote 6 32-bits-long integer. So there is
|
||||
to denote input data whose length is . WinRAR use it to generate private key .
|
||||
|
||||
1. We use  to denote 6 32-bits-long integer. So there is
|
||||
|
||||
<p align="center">
|
||||
<img src="http://latex.codecogs.com/svg.latex?g_j%3D%5Csum_%7Bi%3D0%7D%5E%7B3%7Dg_%7Bj%2Ci%7D%20%5Ccdot%202%5E%7B8i%7D%20%5Cquad%20%5Cquad%20g_%7Bj%2Ci%7D%5Cin%5B0%2C256%29">
|
||||
<img src="assets/formula/28-light.svg#gh-light-mode-only">
|
||||
<img src="assets/formula/28-dark.svg#gh-dark-mode-only">
|
||||
</p>
|
||||
|
||||
2. Let .
|
||||
2. Let .
|
||||
|
||||
3. If , we calculate SHA1 value of ![T-inlined]. Then assign SHA1 state value  to :
|
||||
3. If , we calculate SHA1 value of . Then assign SHA1 state value  to :
|
||||
|
||||
<p align="center">
|
||||
<img src="http://latex.codecogs.com/svg.latex?%5Cbegin%7Baligned%7D%20%5Ctextrm%7BSHA%7D_1%28T%29%26%3DS_0%7C%7CS_1%7C%7CS_2%7C%7CS_3%7C%7CS_4%20%5C%5C%20g_1%26%3DS_0%20%5C%5C%20g_2%26%3DS_1%20%5C%5C%20g_3%26%3DS_2%20%5C%5C%20g_4%26%3DS_3%20%5C%5C%20g_5%26%3DS_4%20%5C%5C%20%5Cend%7Baligned%7D">
|
||||
<img src="assets/formula/33-light.svg#gh-light-mode-only">
|
||||
<img src="assets/formula/33-dark.svg#gh-dark-mode-only">
|
||||
</p>
|
||||
|
||||
Otherwise, when , we let
|
||||
|
||||
Otherwise, when , we let
|
||||
|
||||
<p align="center">
|
||||
<img src="http://latex.codecogs.com/svg.latex?%5Cbegin%7Baligned%7D%20g_1%26%3D%5Ctextrm%7B0xeb3eb781%7D%20%5C%5C%20g_2%26%3D%5Ctextrm%7B0x50265329%7D%20%5C%5C%20g_3%26%3D%5Ctextrm%7B0xdc5ef4a3%7D%20%5C%5C%20g_4%26%3D%5Ctextrm%7B0x6847b9d5%7D%20%5C%5C%20g_5%26%3D%5Ctextrm%7B0xcde43b4c%7D%20%5C%5C%20%5Cend%7Baligned%7D">
|
||||
<img src="assets/formula/35-light.svg#gh-light-mode-only">
|
||||
<img src="assets/formula/35-dark.svg#gh-dark-mode-only">
|
||||
</p>
|
||||
|
||||
4. Regard  as counter, add itself by 1.
|
||||
4. Regard  as counter, add itself by 1.
|
||||
|
||||
Calculate SHA1:
|
||||
|
||||
<p align="center">
|
||||
<img src="http://latex.codecogs.com/svg.latex?%5Ctextrm%7BSHA%7D_1%28g_%7B0%2C0%7D%7C%7Cg_%7B0%2C1%7D%7C%7Cg_%7B0%2C2%7D%7C%7Cg_%7B0%2C3%7D%7C%7Cg_%7B1%2C0%7D%7C%7Cg_%7B1%2C1%7D%7C%7C%5Cldots%7C%7Cg_%7B5%2C0%7D%7C%7Cg_%7B5%2C1%7D%7C%7Cg_%7B5%2C2%7D%7C%7Cg_%7B5%2C3%7D%29%3DS_0%7C%7CS_1%7C%7CS_2%7C%7CS_3%7C%7CS_4">
|
||||
<img src="assets/formula/37-light.svg#gh-light-mode-only">
|
||||
<img src="assets/formula/37-dark.svg#gh-dark-mode-only">
|
||||
</p>
|
||||
|
||||
We takes the lowest 16 bits of  and donote it as .
|
||||
|
||||
We takes the lowest 16 bits of  and donote it as .
|
||||
|
||||
5. Repeat step 4 again with 14 times.
|
||||
|
||||
6. After that, we will get . Then output private key
|
||||
6. After that, we will get . Then output private key
|
||||
|
||||
<p align="center">
|
||||
<img src="http://latex.codecogs.com/svg.latex?k%3D%5Csum_%7Bi%3D1%7D%5E%7B15%7Dk_i%20%5Ccdot%202%5E%7B16i%7D">
|
||||
<img src="assets/formula/41-light.svg#gh-light-mode-only">
|
||||
<img src="assets/formula/41-dark.svg#gh-dark-mode-only">
|
||||
</p>
|
||||
|
||||
## 6. The private key and public key of WinRAR
|
||||
|
||||
Private key ![k-inlined] is
|
||||
Private key  is
|
||||
|
||||
<p align="center">
|
||||
<img src="http://latex.codecogs.com/svg.latex?k%3D%5Ctextrm%7B0x59fe6abcca90bdb95f0105271fa85fb9f11f467450c1ae9044b7fd61d65e%7D%20%5Cquad%20%5Cquad%20k%5Cin%5Cnolinebreak%5Cmathbb%7BZ%7D">
|
||||
<img src="assets/formula/42-light.svg#gh-light-mode-only">
|
||||
<img src="assets/formula/42-dark.svg#gh-dark-mode-only">
|
||||
</p>
|
||||
|
||||
This private key is generated by the algorithm describled in section 5 where the length of data ![T-inlined] is zero.
|
||||
|
||||
Public key ![P-inlined] is
|
||||
This private key is generated by the algorithm describled in section 5 where the length of data  is zero.
|
||||
|
||||
Public key  is
|
||||
|
||||
<p align="center">
|
||||
<img src="http://latex.codecogs.com/svg.latex?%5Cbegin%7Baligned%7D%20P%26%3D%28P_x%2CP_y%29%20%5C%5C%20P_x%26%3D%5Ctextrm%7B0x3861220ed9b36c9753df09a159dfb148135d495db3af8373425ee9a28884ba1a%7D%20%5Cquad%20P_x%5Cin%5Ctextrm%7BGF%7D%28%282%5E%7B15%7D%29%5E%7B17%7D%29%20%5C%5C%20P_y%26%3D%5Ctextrm%7B0x12b64e62db43a56114554b0cbd573379338cea9124c8443c4f50e6c8b013ec20%7D%20%5Cquad%20P_y%5Cin%5Ctextrm%7BGF%7D%28%282%5E%7B15%7D%29%5E%7B17%7D%29%20%5Cend%7Baligned%7D">
|
||||
<img src="assets/formula/43-light.svg#gh-light-mode-only">
|
||||
<img src="assets/formula/43-dark.svg#gh-dark-mode-only">
|
||||
</p>
|
||||
|
||||
|
||||
## 7. Generation of "rarreg.key"
|
||||
|
||||
The generation of license file `rarreg.key` requires 2 arguments:
|
||||
|
|
@ -195,85 +240,96 @@ The generation of license file `rarreg.key` requires 2 arguments:
|
|||
1. Username, an ANSI-encoded string, without null-terminator. Denoted as
|
||||
|
||||
<p align="center">
|
||||
<img src="http://latex.codecogs.com/svg.latex?U%3Du_0u_1%20%5Cldots%20u_%7Bl-1%7D">
|
||||
<img src="assets/formula/44-light.svg#gh-light-mode-only">
|
||||
<img src="assets/formula/44-dark.svg#gh-dark-mode-only">
|
||||
</p>
|
||||
|
||||
2. License type, an ANSI-encoded string, without null-terminator. Denoted as
|
||||
|
||||
<p align="center">
|
||||
<img src="http://latex.codecogs.com/svg.latex?L%3Dl_0l_1%20%5Cldots%20l_%7Bl-1%7D">
|
||||
<img src="assets/formula/45-light.svg#gh-light-mode-only">
|
||||
<img src="assets/formula/45-dark.svg#gh-dark-mode-only">
|
||||
</p>
|
||||
|
||||
The following is the algorithm to generate `rarreg.key`.
|
||||
|
||||
1. Use the algorithm describled in section 5, with argument ![UU-inlined], to generate private key  and public key . Then output hexlified public key string with SM2 compressed public key format. The hexlified public key is denoted as ![Temp-inlined].
|
||||
1. Use the algorithm describled in section 5, with argument , to generate private key  and public key . Then output hexlified public key string with SM2 compressed public key format. The hexlified public key is denoted as .
|
||||
|
||||
The length of ![Temp-inlined] should be 64. If less, pad with `'0'` until the length is 64.
|
||||
The length of  should be 64. If less, pad with `'0'` until the length is 64.
|
||||
|
||||
2. Let ![Data3-inlined] be
|
||||
2. Let  be
|
||||
|
||||
<p align="center">
|
||||
<img src="http://latex.codecogs.com/svg.latex?Data%5E3%3D%5Ctexttt%7B%2260%22%7D%7C%7CTemp_0%7C%7CTemp_1%7C%7C%5Cldots%7C%7CTemp_%7B47%7D">
|
||||
<img src="assets/formula/48-light.svg#gh-light-mode-only">
|
||||
<img src="assets/formula/48-dark.svg#gh-dark-mode-only">
|
||||
</p>
|
||||
|
||||
3. Use the algorithm describled in section 5, with argument ![Data3-inlined], to generate private key  and public key . Then output hexlified public key string with SM2 compressed public key format. The hexlified public key is denoted as ![Data0-inlined].
|
||||
3. Use the algorithm describled in section 5, with argument , to generate private key  and public key . Then output hexlified public key string with SM2 compressed public key format. The hexlified public key is denoted as .
|
||||
|
||||
The length of ![Data0-inlined] should be 64. If less, pad with `'0'` until the length is 64.
|
||||
The length of  should be 64. If less, pad with `'0'` until the length is 64.
|
||||
|
||||
4. Let ![UID-inlined] be
|
||||
4. Let  be
|
||||
|
||||
<p align="center">
|
||||
<img src="http://latex.codecogs.com/svg.latex?UID%3DTemp_%7B48%7D%7C%7CTemp_%7B49%7D%7C%7C%5Cldots%7C%7CTemp_%7B63%7D%7C%7CData%5E0_0%7C%7CData%5E0_1%7C%7CData%5E0_2%7C%7CData%5E0_3">
|
||||
<img src="assets/formula/51-light.svg#gh-light-mode-only">
|
||||
<img src="assets/formula/51-dark.svg#gh-dark-mode-only">
|
||||
</p>
|
||||
|
||||
5. Use the algorithm describled in section 4, with argument ![LL-inlined] and private key ![k-inlined] describled section 6, to get signature .
|
||||
5. Use the algorithm describled in section 4, with argument  and private key  describled section 6, to get signature .
|
||||
|
||||
The bit length of  and  shall not be more than 240. Otherwise, repeat this step.
|
||||
The bit length of  and  shall not be more than 240. Otherwise, repeat this step.
|
||||
|
||||
6. Convert  and  to hex-integer string  and , without `"0x"` prefix.
|
||||
6. Convert  and  to hex-integer string  and , without `"0x"` prefix.
|
||||
|
||||
If the length of  or  is less than 60, pad character `'0'` until the length is 60.
|
||||
If the length of  or  is less than 60, pad character `'0'` until the length is 60.
|
||||
|
||||
7. Let ![Data1-inlined] be
|
||||
7. Let  be
|
||||
|
||||
<p align="center">
|
||||
<img src="http://latex.codecogs.com/svg.latex?Data%5E1%3D%5Ctexttt%7B%2260%22%7D%7C%7CSZ%5E%7Bs_L%7D%7C%7CSZ%5E%7Br_L%7D">
|
||||
<img src="assets/formula/57-light.svg#gh-light-mode-only">
|
||||
<img src="assets/formula/57-dark.svg#gh-dark-mode-only">
|
||||
</p>
|
||||
|
||||
8. Let ![Temp-inlined] be
|
||||
8. Let  be
|
||||
|
||||
<p align="center">
|
||||
<img src="http://latex.codecogs.com/svg.latex?Temp%3DU%7C%7CData%5E0">
|
||||
<img src="assets/formula/58-light.svg#gh-light-mode-only">
|
||||
<img src="assets/formula/58-dark.svg#gh-dark-mode-only">
|
||||
</p>
|
||||
|
||||
Use the algorithm describled in section 4, with argument ![Temp-inlined] and private key ![k-inlined] describled section 6, to get signature .
|
||||
|
||||
The bit length of  and  shall not be more than 240. Otherwise, repeat this step.
|
||||
Use the algorithm describled in section 4, with argument  and private key  describled section 6, to get signature .
|
||||
|
||||
9. Convert  and  to hex-integer string  and , without `"0x"` prefix.
|
||||
The bit length of  and  shall not be more than 240. Otherwise, repeat this step.
|
||||
|
||||
If the length of  or  is less than 60, pad character `'0'` until the length is 60.
|
||||
9. Convert  and  to hex-integer string  and , without `"0x"` prefix.
|
||||
|
||||
10. Let ![Data2-inlined] be
|
||||
If the length of  or  is less than 60, pad character `'0'` until the length is 60.
|
||||
|
||||
10. Let  be
|
||||
|
||||
<p align="center">
|
||||
<img src="http://latex.codecogs.com/svg.latex?Data%5E2%3D%5Ctexttt%7B%2260%22%7D%7C%7CSZ%5E%7Bs_%7BTemp%7D%7D%7C%7CSZ%5E%7Br_%7BTemp%7D%7D">
|
||||
<img src="assets/formula/64-light.svg#gh-light-mode-only">
|
||||
<img src="assets/formula/64-dark.svg#gh-dark-mode-only">
|
||||
</p>
|
||||
|
||||
11. Calculate CRC32 value of
|
||||
|
||||
<p align="center">
|
||||
<img src="http://latex.codecogs.com/svg.latex?L%7C%7CU%7C%7CData%5E0%7C%7CData%5E1%7C%7CData%5E2%7C%7CData%5E3">
|
||||
<img src="assets/formula/65-light.svg#gh-light-mode-only">
|
||||
<img src="assets/formula/65-dark.svg#gh-dark-mode-only">
|
||||
</p>
|
||||
|
||||
|
||||
The final checksum the complement of CRC32 value.
|
||||
|
||||
Then convert the checksum to decimal string . If the length is less than 10, pad character `'0'` until the length is 10.
|
||||
Then convert the checksum to decimal string . If the length is less than 10, pad character `'0'` until the length is 10.
|
||||
|
||||
12. Let ![Data-inlined] be
|
||||
12. Let  be
|
||||
|
||||
<p align="center">
|
||||
<img src="http://latex.codecogs.com/svg.latex?%5Cinline%20Data%3DData%5E0%7C%7CData%5E1%7C%7CData%5E2%7C%7CData%5E3%7C%7CSZ%5E%7Bchecksum%7D">
|
||||
<img src="assets/formula/67-light.svg#gh-light-mode-only">
|
||||
<img src="assets/formula/67-dark.svg#gh-dark-mode-only">
|
||||
</p>
|
||||
|
||||
13. Output with format
|
||||
|
|
@ -287,8 +343,8 @@ The following is the algorithm to generate `rarreg.key`.
|
|||
* UID, taking one line, with format:
|
||||
|
||||
<p align="center">
|
||||
<img src="http://latex.codecogs.com/svg.latex?%5Ctexttt%7B%22UID%3D%22%7D%7C%7CUID">
|
||||
<img src="assets/formula/68-light.svg#gh-light-mode-only">
|
||||
<img src="assets/formula/68-dark.svg#gh-dark-mode-only">
|
||||
</p>
|
||||
|
||||
* Output ![Data-inlined], with 54 characters a line.
|
||||
|
||||
|
||||
* Output , with 54 characters a line.
|
||||
|
|
|
|||
|
|
@ -11,22 +11,18 @@ WinRAR 使用了基于 ECC 的签名算法来生成 `rarreg.key` 文件,其使
|
|||
<img src="assets/formula/1-dark.svg#gh-dark-mode-only">
|
||||
</p>
|
||||
|
||||
各项系数全部位于 。设基域的标准基为:
|
||||
各项系数全部位于 。设基域的标准基为:
|
||||
|
||||
<p align="center">
|
||||
<img src="assets/formula/2-light.svg#gh-light-mode-only">
|
||||
<img src="assets/formula/2-dark.svg#gh-dark-mode-only">
|
||||
</p>
|
||||
|
||||
|
||||
则位于基域  上的元素  可以用如下方式表达:
|
||||
|
||||
<p align="center">
|
||||
<img src="assets/formula/3-light.svg#gh-light-mode-only">
|
||||
<img src="assets/formula/3-dark.svg#gh-dark-mode-only">
|
||||
</p>
|
||||
|
||||
|
||||
---
|
||||
|
||||
复合域   的不可约多项式为:
|
||||
|
|
@ -35,24 +31,18 @@ WinRAR 使用了基于 ECC 的签名算法来生成 `rarreg.key` 文件,其使
|
|||
<img src="assets/formula/4-light.svg#gh-light-mode-only">
|
||||
<img src="assets/formula/4-dark.svg#gh-dark-mode-only">
|
||||
</p>
|
||||
|
||||
|
||||
各项系数全部位于 。设复合域的标准基为:
|
||||
|
||||
<p align="center">
|
||||
<img src="assets/formula/5-light.svg#gh-light-mode-only">
|
||||
<img src="assets/formula/5-dark.svg#gh-dark-mode-only">
|
||||
</p>
|
||||
|
||||
|
||||
则位于复合域   上的元素  可以用如下方式表达:
|
||||
|
||||
<p align="center">
|
||||
<img src="assets/formula/6-light.svg#gh-light-mode-only">
|
||||
<img src="assets/formula/6-dark.svg#gh-dark-mode-only">
|
||||
</p>
|
||||
|
||||
|
||||
---
|
||||
|
||||
为了方便表述我们用255比特的大数  来表示位于复合域   上的元素 。它们的对应关系为:
|
||||
|
|
@ -61,8 +51,6 @@ WinRAR 使用了基于 ECC 的签名算法来生成 `rarreg.key` 文件,其使
|
|||
<img src="assets/formula/7-light.svg#gh-light-mode-only">
|
||||
<img src="assets/formula/7-dark.svg#gh-dark-mode-only">
|
||||
</p>
|
||||
|
||||
|
||||
## 2. 复合域   上的椭圆曲线
|
||||
|
||||
曲线方程为:
|
||||
|
|
@ -71,24 +59,18 @@ WinRAR 使用了基于 ECC 的签名算法来生成 `rarreg.key` 文件,其使
|
|||
<img src="assets/formula/8-light.svg#gh-light-mode-only">
|
||||
<img src="assets/formula/8-dark.svg#gh-dark-mode-only">
|
||||
</p>
|
||||
|
||||
|
||||
基点  为:
|
||||
|
||||
<p align="center">
|
||||
<img src="assets/formula/9-light.svg#gh-light-mode-only">
|
||||
<img src="assets/formula/9-dark.svg#gh-dark-mode-only">
|
||||
</p>
|
||||
|
||||
|
||||
基点  的阶  为:
|
||||
|
||||
<p align="center">
|
||||
<img src="assets/formula/10-light.svg#gh-light-mode-only">
|
||||
<img src="assets/formula/10-dark.svg#gh-dark-mode-only">
|
||||
</p>
|
||||
|
||||
|
||||
## 3. 消息哈希算法
|
||||
|
||||
设长度为  的消息为:
|
||||
|
|
@ -97,16 +79,12 @@ WinRAR 使用了基于 ECC 的签名算法来生成 `rarreg.key` 文件,其使
|
|||
<img src="assets/formula/11-light.svg#gh-light-mode-only">
|
||||
<img src="assets/formula/11-dark.svg#gh-dark-mode-only">
|
||||
</p>
|
||||
|
||||
|
||||
则消息  的 SHA1 值为:
|
||||
|
||||
<p align="center">
|
||||
<img src="assets/formula/12-light.svg#gh-light-mode-only">
|
||||
<img src="assets/formula/12-dark.svg#gh-dark-mode-only">
|
||||
</p>
|
||||
|
||||
|
||||
其中  为 SHA1 算法输出时的5个状态值;将这5个状态值按照大端字节序依次输出,即为的 SHA1 哈希值 。
|
||||
|
||||
WinRAR 在做完 SHA1 计算后,采用大数  作为 ECC 签名时消息的哈希:
|
||||
|
|
@ -124,8 +102,6 @@ WinRAR 在做完 SHA1 计算后,采用大数 ,则签名  为:
|
||||
|
||||
1. 生成随机数 ,满足 。
|
||||
|
|
@ -162,8 +138,6 @@ WinRAR 在做完 SHA1 计算后,采用大数 。
|
||||
|
||||
1. 设6个32位整数为 ,则有
|
||||
|
|
@ -175,7 +149,7 @@ WinRAR 在做完 SHA1 计算后,采用大数 。
|
||||
|
||||
3. 如果  则计算  的 SHA1 值,并将状态值  赋值给 :
|
||||
3. 如果  则计算  的 SHA1 值,并将状态值  赋值给 :
|
||||
|
||||
<p align="center">
|
||||
<img src="assets/formula/33-light.svg#gh-light-mode-only">
|
||||
|
|
@ -219,8 +193,6 @@ WinRAR 的私钥 ![k]
|
|||
<img src="assets/formula/42-light.svg#gh-light-mode-only">
|
||||
<img src="assets/formula/42-dark.svg#gh-dark-mode-only">
|
||||
</p>
|
||||
|
||||
|
||||
该私钥是通过算法5生成的,其中数据  的长度为0。
|
||||
|
||||
公钥  为:
|
||||
|
|
@ -229,8 +201,6 @@ WinRAR 的私钥 ![k]
|
|||
<img src="assets/formula/43-light.svg#gh-light-mode-only">
|
||||
<img src="assets/formula/43-dark.svg#gh-dark-mode-only">
|
||||
</p>
|
||||
|
||||
|
||||
## 7. 授权文件"rarreg.key"的生成
|
||||
|
||||
授权文件的生成需要两个参数:
|
||||
|
|
@ -338,7 +308,7 @@ WinRAR 的私钥 ![k]
|
|||
* UID,占一行:
|
||||
|
||||
<p align="center">
|
||||
<img src="assets/formula/68-light.svg#gh-light-mode-only">
|
||||
<img src="assets/formula/68-light.svg#gh-light-mode-only">
|
||||
<img src="assets/formula/68-dark.svg#gh-dark-mode-only">
|
||||
</p>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue