From 48cf9f04c9da8dc92c7661f110b8a99124f915b1 Mon Sep 17 00:00:00 2001 From: bitcookies Date: Wed, 9 Feb 2022 21:54:39 +0800 Subject: [PATCH 01/11] text dark mode --- README.HOW_DOES_IT_WORK.md | 27 -- README.HOW_DOES_IT_WORK.zh-CN.md | 50 +-- assets/README.HOW_DOES_IT_WORK.md.bak | 321 ++++++++++++++++++++ assets/README.HOW_DOES_IT_WORK.zh-CN.md.bak | 319 +++++++++++++++++++ assets/formula/1-dark.svg | 29 ++ assets/formula/1-light.svg | 29 ++ assets/formula/GF2-inlined-dark.svg | 18 ++ assets/formula/GF2-inlined-light.svg | 18 ++ assets/formula/GF2p15-inlined-dark.svg | 22 ++ assets/formula/GF2p15-inlined-light.svg | 22 ++ assets/formula/GF2p15p17-inlined-dark.svg | 27 ++ assets/formula/GF2p15p17-inlined-light.svg | 27 ++ assets/formula/Image display.txt | 1 + 13 files changed, 845 insertions(+), 65 deletions(-) create mode 100644 assets/README.HOW_DOES_IT_WORK.md.bak create mode 100644 assets/README.HOW_DOES_IT_WORK.zh-CN.md.bak create mode 100644 assets/formula/1-dark.svg create mode 100644 assets/formula/1-light.svg create mode 100644 assets/formula/GF2-inlined-dark.svg create mode 100644 assets/formula/GF2-inlined-light.svg create mode 100644 assets/formula/GF2p15-inlined-dark.svg create mode 100644 assets/formula/GF2p15-inlined-light.svg create mode 100644 assets/formula/GF2p15p17-inlined-dark.svg create mode 100644 assets/formula/GF2p15p17-inlined-light.svg create mode 100644 assets/formula/Image display.txt diff --git a/README.HOW_DOES_IT_WORK.md b/README.HOW_DOES_IT_WORK.md index 336df37..585d17b 100644 --- a/README.HOW_DOES_IT_WORK.md +++ b/README.HOW_DOES_IT_WORK.md @@ -1,30 +1,3 @@ -[GF2-inlined]: http://latex.codecogs.com/svg.latex?%5Cinline%20%5Ctextrm%7BGF%7D%282%29 -[GF2p15-inlined]: http://latex.codecogs.com/svg.latex?%5Cinline%20%5Ctextrm%7BGF%7D%282%5E%7B15%7D%29 -[GF2p15p17-inlined]: http://latex.codecogs.com/svg.latex?%5Cinline%20%5Ctextrm%7BGF%7D%28%282%5E%7B15%7D%29%5E%7B17%7D%29 -[A-inlined]: http://latex.codecogs.com/svg.latex?%5Cinline%20A -[B-inlined]: http://latex.codecogs.com/svg.latex?%5Cinline%20B -[D-inlined]: http://latex.codecogs.com/svg.latex?%5Cinline%20D -[G-inlined]: http://latex.codecogs.com/svg.latex?%5Cinline%20G -[M-inlined]: http://latex.codecogs.com/svg.latex?%5Cinline%20M -[P-inlined]: http://latex.codecogs.com/svg.latex?%5Cinline%20P -[h-inlined]: http://latex.codecogs.com/svg.latex?%5Cinline%20h -[k-inlined]: http://latex.codecogs.com/svg.latex?%5Cinline%20k -[l-inlined]: http://latex.codecogs.com/svg.latex?%5Cinline%20l -[n-inlined]: http://latex.codecogs.com/svg.latex?%5Cinline%20n -[r-inlined]: http://latex.codecogs.com/svg.latex?%5Cinline%20r -[s-inlined]: http://latex.codecogs.com/svg.latex?%5Cinline%20s -[T-inlined]: http://latex.codecogs.com/svg.latex?%5Cinline%20T -[UU-inlined]: http://latex.codecogs.com/svg.latex?%5Cinline%20U -[LL-inlined]: http://latex.codecogs.com/svg.latex?%5Cinline%20L -[Rnd-inlined]: http://latex.codecogs.com/svg.latex?%5Cinline%20Rnd -[Temp-inlined]: http://latex.codecogs.com/svg.latex?%5Cinline%20Temp -[UID-inlined]: http://latex.codecogs.com/svg.latex?%5Cinline%20UID -[Data-inlined]: http://latex.codecogs.com/svg.latex?%5Cinline%20Data -[Data0-inlined]: http://latex.codecogs.com/svg.latex?%5Cinline%20Data%5E0 -[Data1-inlined]: http://latex.codecogs.com/svg.latex?%5Cinline%20Data%5E1 -[Data2-inlined]: http://latex.codecogs.com/svg.latex?%5Cinline%20Data%5E2 -[Data3-inlined]: http://latex.codecogs.com/svg.latex?%5Cinline%20Data%5E3 - # 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]. diff --git a/README.HOW_DOES_IT_WORK.zh-CN.md b/README.HOW_DOES_IT_WORK.zh-CN.md index 328d8d3..ae31d5e 100644 --- a/README.HOW_DOES_IT_WORK.zh-CN.md +++ b/README.HOW_DOES_IT_WORK.zh-CN.md @@ -1,49 +1,24 @@ -[GF2-inlined]: http://latex.codecogs.com/svg.latex?%5Cinline%20%5Ctextrm%7BGF%7D%282%29 -[GF2p15-inlined]: http://latex.codecogs.com/svg.latex?%5Cinline%20%5Ctextrm%7BGF%7D%282%5E%7B15%7D%29 -[GF2p15p17-inlined]: http://latex.codecogs.com/svg.latex?%5Cinline%20%5Ctextrm%7BGF%7D%28%282%5E%7B15%7D%29%5E%7B17%7D%29 -[A-inlined]: http://latex.codecogs.com/svg.latex?%5Cinline%20A -[B-inlined]: http://latex.codecogs.com/svg.latex?%5Cinline%20B -[D-inlined]: http://latex.codecogs.com/svg.latex?%5Cinline%20D -[G-inlined]: http://latex.codecogs.com/svg.latex?%5Cinline%20G -[M-inlined]: http://latex.codecogs.com/svg.latex?%5Cinline%20M -[P-inlined]: http://latex.codecogs.com/svg.latex?%5Cinline%20P -[h-inlined]: http://latex.codecogs.com/svg.latex?%5Cinline%20h -[k-inlined]: http://latex.codecogs.com/svg.latex?%5Cinline%20k -[l-inlined]: http://latex.codecogs.com/svg.latex?%5Cinline%20l -[n-inlined]: http://latex.codecogs.com/svg.latex?%5Cinline%20n -[r-inlined]: http://latex.codecogs.com/svg.latex?%5Cinline%20r -[s-inlined]: http://latex.codecogs.com/svg.latex?%5Cinline%20s -[T-inlined]: http://latex.codecogs.com/svg.latex?%5Cinline%20T -[UU-inlined]: http://latex.codecogs.com/svg.latex?%5Cinline%20U -[LL-inlined]: http://latex.codecogs.com/svg.latex?%5Cinline%20L -[Rnd-inlined]: http://latex.codecogs.com/svg.latex?%5Cinline%20Rnd -[Temp-inlined]: http://latex.codecogs.com/svg.latex?%5Cinline%20Temp -[UID-inlined]: http://latex.codecogs.com/svg.latex?%5Cinline%20UID -[Data-inlined]: http://latex.codecogs.com/svg.latex?%5Cinline%20Data -[Data0-inlined]: http://latex.codecogs.com/svg.latex?%5Cinline%20Data%5E0 -[Data1-inlined]: http://latex.codecogs.com/svg.latex?%5Cinline%20Data%5E1 -[Data2-inlined]: http://latex.codecogs.com/svg.latex?%5Cinline%20Data%5E2 -[Data3-inlined]: http://latex.codecogs.com/svg.latex?%5Cinline%20Data%5E3 - # "rarreg.key"是如何生成的? -WinRAR 使用了基于 ECC 的签名算法来生成 `rarreg.key` 文件,其使用的签名算法是中国 SM2 数字签名算法的变体。与各种标准 ECDSA 不同的是,WinRAR 使用的椭圆曲线是一个基于复合域 ![GF2p15p17-inlined] 上的曲线。 +WinRAR 使用了基于 ECC 的签名算法来生成 `rarreg.key` 文件,其使用的签名算法是中国 SM2 数字签名算法的变体。与各种标准 ECDSA 不同的是,WinRAR 使用的椭圆曲线是一个基于复合域 ![GF2p15p17-inlined](assets/formula/GF2p15p17-inlined-light.svg#gh-light-mode-only) ![GF2p15p17-inlined](assets/formula/GF2p15p17-inlined-dark.svg#gh-dark-mode-only) 上的曲线。 -## 1. 复合域 ![GF2p15p17-inlined] +## 1. 复合域 ![GF2p15p17-inlined](assets/formula/GF2p15p17-inlined-light.svg#gh-light-mode-only) ![GF2p15p17-inlined](assets/formula/GF2p15p17-inlined-dark.svg#gh-dark-mode-only) -基域 ![GF2p15-inlined] 采用标准基(多项式基)来表达,采用的不可约多项式为: +基域 ![GF2p15-inlined](assets/formula/GF2p15-inlined-light.svg#gh-light-mode-only)![GF2p15-inlined](assets/formula/GF2p15-inlined-dark.svg#gh-dark-mode-only) 采用标准基(多项式基)来表达,采用的不可约多项式为:

- +

-各项系数全部位于 ![GF2-inlined]。设基域的标准基为: + +各项系数全部位于 ![GF2p15-inlined](assets/formula/GF2-inlined-light.svg#gh-light-mode-only)![GF2p15-inlined](assets/formula/GF2-inlined-dark.svg#gh-dark-mode-only)。设基域的标准基为:

-则位于基域 ![GF2p15-inlined] 上的元素 ![A-inlined] 可以用如下方式表达: +则位于基域 ![GF2p15-inlined](assets/formula/GF2p15-inlined-light.svg#gh-light-mode-only)![GF2p15-inlined](assets/formula/GF2p15-inlined-dark.svg#gh-dark-mode-only) 上的元素 ![A-inlined] 可以用如下方式表达:

-各项系数全部位于 ![GF2p15-inlined]。设复合域的标准基为: +各项系数全部位于 ![GF2p15-inlined](assets/formula/GF2p15-inlined-light.svg#gh-light-mode-only)![GF2p15-inlined](assets/formula/GF2p15-inlined-dark.svg#gh-dark-mode-only)。设复合域的标准基为:

-则位于复合域 ![GF2p15p17-inlined] 上的元素 ![B-inlined] 可以用如下方式表达: +则位于复合域 ![GF2p15p17-inlined](assets/formula/GF2p15p17-inlined-light.svg#gh-light-mode-only) ![GF2p15p17-inlined](assets/formula/GF2p15p17-inlined-dark.svg#gh-dark-mode-only) 上的元素 ![B-inlined] 可以用如下方式表达:

* 将 ![Data-inlined] 按照每行54个字符输出。 - diff --git a/assets/README.HOW_DOES_IT_WORK.md.bak b/assets/README.HOW_DOES_IT_WORK.md.bak new file mode 100644 index 0000000..336df37 --- /dev/null +++ b/assets/README.HOW_DOES_IT_WORK.md.bak @@ -0,0 +1,321 @@ +[GF2-inlined]: http://latex.codecogs.com/svg.latex?%5Cinline%20%5Ctextrm%7BGF%7D%282%29 +[GF2p15-inlined]: http://latex.codecogs.com/svg.latex?%5Cinline%20%5Ctextrm%7BGF%7D%282%5E%7B15%7D%29 +[GF2p15p17-inlined]: http://latex.codecogs.com/svg.latex?%5Cinline%20%5Ctextrm%7BGF%7D%28%282%5E%7B15%7D%29%5E%7B17%7D%29 +[A-inlined]: http://latex.codecogs.com/svg.latex?%5Cinline%20A +[B-inlined]: http://latex.codecogs.com/svg.latex?%5Cinline%20B +[D-inlined]: http://latex.codecogs.com/svg.latex?%5Cinline%20D +[G-inlined]: http://latex.codecogs.com/svg.latex?%5Cinline%20G +[M-inlined]: http://latex.codecogs.com/svg.latex?%5Cinline%20M +[P-inlined]: http://latex.codecogs.com/svg.latex?%5Cinline%20P +[h-inlined]: http://latex.codecogs.com/svg.latex?%5Cinline%20h +[k-inlined]: http://latex.codecogs.com/svg.latex?%5Cinline%20k +[l-inlined]: http://latex.codecogs.com/svg.latex?%5Cinline%20l +[n-inlined]: http://latex.codecogs.com/svg.latex?%5Cinline%20n +[r-inlined]: http://latex.codecogs.com/svg.latex?%5Cinline%20r +[s-inlined]: http://latex.codecogs.com/svg.latex?%5Cinline%20s +[T-inlined]: http://latex.codecogs.com/svg.latex?%5Cinline%20T +[UU-inlined]: http://latex.codecogs.com/svg.latex?%5Cinline%20U +[LL-inlined]: http://latex.codecogs.com/svg.latex?%5Cinline%20L +[Rnd-inlined]: http://latex.codecogs.com/svg.latex?%5Cinline%20Rnd +[Temp-inlined]: http://latex.codecogs.com/svg.latex?%5Cinline%20Temp +[UID-inlined]: http://latex.codecogs.com/svg.latex?%5Cinline%20UID +[Data-inlined]: http://latex.codecogs.com/svg.latex?%5Cinline%20Data +[Data0-inlined]: http://latex.codecogs.com/svg.latex?%5Cinline%20Data%5E0 +[Data1-inlined]: http://latex.codecogs.com/svg.latex?%5Cinline%20Data%5E1 +[Data2-inlined]: http://latex.codecogs.com/svg.latex?%5Cinline%20Data%5E2 +[Data3-inlined]: http://latex.codecogs.com/svg.latex?%5Cinline%20Data%5E3 + +# 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]. + +## 1. Composite field ![GF2p15p17-inlined] + +Elements in ground field ![GF2p15-inlined] are represented with standard basis, i.e. polynomial basis. The irreducible polynomial is + +

+ + +where each coefficients is in ![GF2-inlined]. If we use + +

+ + +as the standard basis of the ground field, an element ![A-inlined] in ![GF2p15-inlined] can be denoted as + +

+ + +--- + +The irreducible polynomial of composite field ![GF2p15p17-inlined] is + +

+ + +where each coefficients is in ![GF2p15-inlined]. If we use + +

+ + +as the standard basis of the composite field, an element ![B-inlined] in ![GF2p15p17-inlined] can be denoted as + +

+ + +--- + +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 + +

+ + +## 2. Elliptic curve over ![GF2p15p17-inlined] + +The equation of the elliptic curve that WinRAR uses is + +

+ + +The base point ![G-inlined] is + +

+ + +whose order ![n-inlined] is + +

+ + +## 3. Message hash algorithm + +We use + +

+ + +to denote a message whose length is ![l-inlined]. So the SHA1 value of ![M-inlined] should be + +

+ + +where ![](http://latex.codecogs.com/svg.latex?%5Cinline%20S_0%2CS_1%2CS_2%2CS_3%2CS_4) 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. + +

+ + +## 4. ECC digital signature algorithm + +We use ![k-inlined] to denote private key, ![P-inlined] to denote public key. So there must be + +

+ + +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 ![](http://latex.codecogs.com/svg.latex?%5Cinline%200%3CRnd%3Cn). + +2. Calculate ![r-inlined] + +

+ +

+ + where ![](http://latex.codecogs.com/svg.latex?%5Cinline%20%28Rnd%20%5Ccdot%20G%29_x) means we take X coordinate of ![](http://latex.codecogs.com/svg.latex?%5Cinline%20Rnd%20%5Ccdot%20G) and convert it from ![GF2p15p17-inlined] to a big integer. + + If ![](http://latex.codecogs.com/svg.latex?%5Cinline%20r%3D0) or ![](http://latex.codecogs.com/svg.latex?%5Cinline%20r+Rnd%3Dn), go back to step 1. + +3. Calculate ![s-inlined] + +

+ +

+ + If ![](http://latex.codecogs.com/svg.latex?%5Cinline%20s%3D0), go back to step 1. + +4. Output ![](http://latex.codecogs.com/svg.latex?%5Cinline%20%28r%2Cs%29). + +## 5. WinRAR private key generation algorithm + +We use + +

+ +

+ +to denote input data whose length is ![l-inlined]. WinRAR use it to generate private key ![k-inlined]. + +1. We use ![](http://latex.codecogs.com/svg.latex?%5Cinline%20g_0%2Cg_1%2Cg_2%2Cg_3%2Cg_4%2Cg_5) to denote 6 32-bits-long integer. So there is + +

+ +

+ +2. Let ![](http://latex.codecogs.com/svg.latex?%5Cinline%20g_0%3D0). + +3. If ![](http://latex.codecogs.com/svg.latex?%5Cinline%20l%5Cneq%200), we calculate SHA1 value of ![T-inlined]. Then assign SHA1 state value ![](http://latex.codecogs.com/svg.latex?%5Cinline%20S_i) to ![](http://latex.codecogs.com/svg.latex?%5Cinline%20g_%7Bi+1%7D): + +

+ +

+ + Otherwise, when ![](http://latex.codecogs.com/svg.latex?%5Cinline%20l%3D0), we let + +

+ +

+ +4. Regard ![](http://latex.codecogs.com/svg.latex?%5Cinline%20g_0) as counter, add itself by 1. + + Calculate SHA1: + +

+ +

+ + We takes the lowest 16 bits of ![](http://latex.codecogs.com/svg.latex?%5Cinline%20S_0) and donote it as ![](http://latex.codecogs.com/svg.latex?%5Cinline%20k_%7Bg_0%7D). + +5. Repeat step 4 again with 14 times. + +6. After that, we will get ![](http://latex.codecogs.com/svg.latex?%5Cinline%20k_1%2Ck_2%2Ck_3%2C%5Cldots%2Ck_%7B15%7D). Then output private key + +

+ +

+ +## 6. The private key and public key of WinRAR + +Private key ![k-inlined] is + +

+ +

+ +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 + +

+ +

+ +## 7. Generation of "rarreg.key" + +The generation of license file `rarreg.key` requires 2 arguments: + +1. Username, an ANSI-encoded string, without null-terminator. Denoted as + +

+ +

+ +2. License type, an ANSI-encoded string, without null-terminator. Denoted as + +

+ +

+ +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 ![](http://latex.codecogs.com/svg.latex?%5Cinline%20k_U) and public key ![](http://latex.codecogs.com/svg.latex?%5Cinline%20P_U). Then output hexlified public key string with SM2 compressed public key format. The hexlified public key is denoted as ![Temp-inlined]. + + The length of ![Temp-inlined] should be 64. If less, pad with `'0'` until the length is 64. + +2. Let ![Data3-inlined] be + +

+ +

+ +3. Use the algorithm describled in section 5, with argument ![Data3-inlined], to generate private key ![](http://latex.codecogs.com/svg.latex?%5Cinline%20k_%7BData%5E3%7D) and public key ![](http://latex.codecogs.com/svg.latex?%5Cinline%20P_%7BData%5E3%7D). Then output hexlified public key string with SM2 compressed public key format. The hexlified public key is denoted as ![Data0-inlined]. + + The length of ![Data0-inlined] should be 64. If less, pad with `'0'` until the length is 64. + +4. Let ![UID-inlined] be + +

+ +

+ +5. Use the algorithm describled in section 4, with argument ![LL-inlined] and private key ![k-inlined] describled section 6, to get signature ![](http://latex.codecogs.com/svg.latex?%5Cinline%20%28r_L%2Cs_L%29). + + The bit length of ![](http://latex.codecogs.com/svg.latex?%5Cinline%20r_L) and ![](http://latex.codecogs.com/svg.latex?%5Cinline%20s_L) shall not be more than 240. Otherwise, repeat this step. + +6. Convert ![](http://latex.codecogs.com/svg.latex?%5Cinline%20r_L) and ![](http://latex.codecogs.com/svg.latex?%5Cinline%20s_L) to hex-integer string ![](http://latex.codecogs.com/svg.latex?%5Cinline%20SZ%5E%7Br_L%7D) and ![](http://latex.codecogs.com/svg.latex?%5Cinline%20SZ%5E%7Bs_L%7D), without `"0x"` prefix. + + If the length of ![](http://latex.codecogs.com/svg.latex?%5Cinline%20SZ%5E%7Br_L%7D) or ![](http://latex.codecogs.com/svg.latex?%5Cinline%20SZ%5E%7Bs_L%7D) is less than 60, pad character `'0'` until the length is 60. + +7. Let ![Data1-inlined] be + +

+ +

+ +8. Let ![Temp-inlined] be + +

+ +

+ + Use the algorithm describled in section 4, with argument ![Temp-inlined] and private key ![k-inlined] describled section 6, to get signature ![](http://latex.codecogs.com/svg.latex?%5Cinline%20%28r_%7BTemp%7D%2Cs_%7BTemp%7D%29). + + The bit length of ![](http://latex.codecogs.com/svg.latex?%5Cinline%20r_%7BTemp%7D) and ![](http://latex.codecogs.com/svg.latex?%5Cinline%20s_%7BTemp%7D) shall not be more than 240. Otherwise, repeat this step. + +9. Convert ![](http://latex.codecogs.com/svg.latex?%5Cinline%20r_%7BTemp%7D) and ![](http://latex.codecogs.com/svg.latex?%5Cinline%20s_%7BTemp%7D) to hex-integer string ![](http://latex.codecogs.com/svg.latex?%5Cinline%20SZ%5E%7Br_%7BTemp%7D%7D) and ![](http://latex.codecogs.com/svg.latex?%5Cinline%20SZ%5E%7Bs_%7BTemp%7D%7D), without `"0x"` prefix. + + If the length of ![](http://latex.codecogs.com/svg.latex?%5Cinline%20SZ%5E%7Br_%7BTemp%7D%7D) or ![](http://latex.codecogs.com/svg.latex?%5Cinline%20SZ%5E%7Bs_%7BTemp%7D%7D) is less than 60, pad character `'0'` until the length is 60. + +10. Let ![Data2-inlined] be + +

+ +

+ +11. Calculate CRC32 value of + +

+ +

+ + The final checksum the complement of CRC32 value. + + Then convert the checksum to decimal string ![](http://latex.codecogs.com/svg.latex?%5Cinline%20SZ%5E%7Bchecksum%7D). If the length is less than 10, pad character `'0'` until the length is 10. + +12. Let ![Data-inlined] be + +

+ +

+ +13. Output with format + + * A fixed header `"RAR registration data"`, taking one line. + + * Username, taking one line. + + * License type, taking one line + + * UID, taking one line, with format: + +

+ +

+ + * Output ![Data-inlined], with 54 characters a line. + diff --git a/assets/README.HOW_DOES_IT_WORK.zh-CN.md.bak b/assets/README.HOW_DOES_IT_WORK.zh-CN.md.bak new file mode 100644 index 0000000..579107a --- /dev/null +++ b/assets/README.HOW_DOES_IT_WORK.zh-CN.md.bak @@ -0,0 +1,319 @@ +[GF2-inlined]: http://latex.codecogs.com/svg.latex?%5Cinline%20%5Ctextrm%7BGF%7D%282%29 +[GF2p15-inlined]: http://latex.codecogs.com/svg.latex?%5Cinline%20%5Ctextrm%7BGF%7D%282%5E%7B15%7D%29 +[GF2p15p17-inlined]: http://latex.codecogs.com/svg.latex?%5Cinline%20%5Ctextrm%7BGF%7D%28%282%5E%7B15%7D%29%5E%7B17%7D%29 +[A-inlined]: http://latex.codecogs.com/svg.latex?%5Cinline%20A +[B-inlined]: http://latex.codecogs.com/svg.latex?%5Cinline%20B +[D-inlined]: http://latex.codecogs.com/svg.latex?%5Cinline%20D +[G-inlined]: http://latex.codecogs.com/svg.latex?%5Cinline%20G +[M-inlined]: http://latex.codecogs.com/svg.latex?%5Cinline%20M +[P-inlined]: http://latex.codecogs.com/svg.latex?%5Cinline%20P +[h-inlined]: http://latex.codecogs.com/svg.latex?%5Cinline%20h +[k-inlined]: http://latex.codecogs.com/svg.latex?%5Cinline%20k +[l-inlined]: http://latex.codecogs.com/svg.latex?%5Cinline%20l +[n-inlined]: http://latex.codecogs.com/svg.latex?%5Cinline%20n +[r-inlined]: http://latex.codecogs.com/svg.latex?%5Cinline%20r +[s-inlined]: http://latex.codecogs.com/svg.latex?%5Cinline%20s +[T-inlined]: http://latex.codecogs.com/svg.latex?%5Cinline%20T +[UU-inlined]: http://latex.codecogs.com/svg.latex?%5Cinline%20U +[LL-inlined]: http://latex.codecogs.com/svg.latex?%5Cinline%20L +[Rnd-inlined]: http://latex.codecogs.com/svg.latex?%5Cinline%20Rnd +[Temp-inlined]: http://latex.codecogs.com/svg.latex?%5Cinline%20Temp +[UID-inlined]: http://latex.codecogs.com/svg.latex?%5Cinline%20UID +[Data-inlined]: http://latex.codecogs.com/svg.latex?%5Cinline%20Data +[Data0-inlined]: http://latex.codecogs.com/svg.latex?%5Cinline%20Data%5E0 +[Data1-inlined]: http://latex.codecogs.com/svg.latex?%5Cinline%20Data%5E1 +[Data2-inlined]: http://latex.codecogs.com/svg.latex?%5Cinline%20Data%5E2 +[Data3-inlined]: http://latex.codecogs.com/svg.latex?%5Cinline%20Data%5E3 + +# "rarreg.key"是如何生成的? + +WinRAR 使用了基于 ECC 的签名算法来生成 `rarreg.key` 文件,其使用的签名算法是中国 SM2 数字签名算法的变体。与各种标准 ECDSA 不同的是,WinRAR 使用的椭圆曲线是一个基于复合域 ![GF2p15p17-inlined] 上的曲线。 + +## 1. 复合域 ![GF2p15p17-inlined] + +基域 ![GF2p15-inlined] 采用标准基(多项式基)来表达,采用的不可约多项式为: + +

+ +

+ +各项系数全部位于 ![GF2-inlined]。设基域的标准基为: + +

+ + +则位于基域 ![GF2p15-inlined] 上的元素 ![A-inlined] 可以用如下方式表达: + +

+ + +--- + +复合域 ![GF2p15p17-inlined] 的不可约多项式为: + +

+ + +各项系数全部位于 ![GF2p15-inlined]。设复合域的标准基为: + +

+ + +则位于复合域 ![GF2p15p17-inlined] 上的元素 ![B-inlined] 可以用如下方式表达: + +

+ + +--- + +为了方便表述我们用255比特的大数 ![D-inlined] 来表示位于复合域 ![GF2p15p17-inlined] 上的元素 ![B-inlined]。它们的对应关系为: + +

+ + +## 2. 复合域 ![GF2p15p17-inlined] 上的椭圆曲线 + +曲线方程为: + +

+ + +基点 ![G-inlined] 为: + +

+ + +基点 ![G-inlined] 的阶 ![n-inlined] 为: + +

+ + +## 3. 消息哈希算法 + +设长度为 ![l-inlined] 的消息为: + +

+ + +则消息 ![M-inlined] 的SHA1值为: + +

+ + +其中 ![](http://latex.codecogs.com/svg.latex?%5Cinline%20S_0%2CS_1%2CS_2%2CS_3%2CS_4) 为SHA1算法输出时的5个状态值;将这5个状态值按照大端字节序依次输出,即为的SHA1哈希值 ![](http://latex.codecogs.com/svg.latex?%5Cinline%20%5Ctextrm%7BSHA%7D_1%28M%29)。 + +WinRAR在做完SHA1计算后,采用大数 ![h-inlined] 作为ECC签名时消息的哈希: + +

+ + + +## 4. ECC签名算法 + +设私钥为 ![k-inlined],公钥为 ![P-inlined],即: + +

+ + +消息哈希为 ![h-inlined],则签名 ![](http://latex.codecogs.com/svg.latex?%5Cinline%20%28r%2Cs%29) 为: + +1. 生成随机数 ![Rnd-inlined],满足 ![](http://latex.codecogs.com/svg.latex?%5Cinline%200%3CRnd%3Cn)。 + +2. 计算 ![r-inlined] + +

+ +

+ + 其中 ![](http://latex.codecogs.com/svg.latex?%5Cinline%20%28Rnd%20%5Ccdot%20G%29_x) 表示取 ![](http://latex.codecogs.com/svg.latex?%5Cinline%20Rnd%20%5Ccdot%20G) 的X坐标,同时将X坐标从 ![GF2p15p17-inlined] 转换为大数。 + + 若 ![](http://latex.codecogs.com/svg.latex?%5Cinline%20r%3D0) 或者 ![](http://latex.codecogs.com/svg.latex?%5Cinline%20r+Rnd%3Dn) 则回到步骤1。 + +3. 计算 ![s-inlined] + +

+ +

+ + 若 ![](http://latex.codecogs.com/svg.latex?%5Cinline%20s%3D0) 则回到步骤1。 + +4. 输出 ![](http://latex.codecogs.com/svg.latex?%5Cinline%20%28r%2Cs%29)。 + +## 5. WinRAR的私钥生成算法 + +该算法会利用长度为 ![l-inlined] 的数据 + +

+ +

+ +来生成私钥 ![k-inlined]。 + +1. 设6个32位整数为 ![](http://latex.codecogs.com/svg.latex?%5Cinline%20g_0%2Cg_1%2Cg_2%2Cg_3%2Cg_4%2Cg_5),则有 + +

+ +

+ +2. 令 ![](http://latex.codecogs.com/svg.latex?%5Cinline%20g_0%3D0)。 + +3. 如果 ![](http://latex.codecogs.com/svg.latex?%5Cinline%20l%5Cneq%200) 则计算 ![T-inlined] 的SHA1值,并将状态值 ![](http://latex.codecogs.com/svg.latex?%5Cinline%20S_i) 赋值给 ![](http://latex.codecogs.com/svg.latex?%5Cinline%20g_%7Bi+1%7D): + +

+ +

+ + 否则,即 ![](http://latex.codecogs.com/svg.latex?%5Cinline%20l%3D0) 时,令: + +

+ +

+ +4. 把 ![](http://latex.codecogs.com/svg.latex?%5Cinline%20g_0) 作为计数器,自增1。 + + 计算SHA1值: + +

+ +

+ + 取 ![](http://latex.codecogs.com/svg.latex?%5Cinline%20S_0) 的低16位并记为 ![](http://latex.codecogs.com/svg.latex?%5Cinline%20k_%7Bg_0%7D)。 + +5. 步骤4再重复14次。 + +6. 重复执行完后会得到 ![](http://latex.codecogs.com/svg.latex?%5Cinline%20k_1%2Ck_2%2Ck_3%2C%5Cldots%2Ck_%7B15%7D),则输出私钥 + +

+ +

+ +## 6. WinRAR的公钥和私钥 + +WinRAR的私钥 ![k-inlined] 为: + +

+ +

+ +该私钥是通过算法5生成的,其中数据 ![T-inlined] 的长度为0。 + +公钥 ![P-inlined] 为: + +

+ +

+ +## 7. 授权文件"rarreg.key"的生成 + +授权文件的生成需要两个参数: + +1. 用户名的ANSI字符串,不包括null-terminator;记为 + +

+ +

+ +2. 授权类型的ANSI字符串,不包括null-terminator;记为 + +

+ +

+ +`rarreg.key` 的生成算法如下: + +1. 使用用户名 ![UU-inlined] 通过算法5计算出私钥 ![](http://latex.codecogs.com/svg.latex?%5Cinline%20k_U) 以及公钥 ![](http://latex.codecogs.com/svg.latex?%5Cinline%20P_U),并将公钥 ![](http://latex.codecogs.com/svg.latex?%5Cinline%20P_U) 按照SM2压缩公钥格式以Hex字符串(ASCII编码)的形式输出。得到的Hex字符串记为临时值 ![Temp-inlined]。 + + ![Temp-inlined] 的长度应该为64;若长度不足,则在前面补字符`'0'`,直到长度为64。 + +2. 令字符串 ![Data3-inlined]为 + +

+ +

+ +3. 使用 ![Data3-inlined] 通过算法5计算出私钥 ![](http://latex.codecogs.com/svg.latex?%5Cinline%20k_%7BData%5E3%7D) 以及公钥 ![](http://latex.codecogs.com/svg.latex?%5Cinline%20P_%7BData%5E3%7D),并将公钥 ![](http://latex.codecogs.com/svg.latex?%5Cinline%20P_%7BData%5E3%7D) 按照SM2压缩公钥格式以Hex字符串(ASCII编码)的形式输出。得到的Hex字符串记为 ![Data0-inlined]。 + + ![Data0-inlined] 的长度应该为64;若长度不足,则在前面补字符`'0'`,直到长度为64。 + +4. 令字符串 ![UID-inlined]为 + +

+ +

+ +5. 对授权类型 ![LL-inlined] 使用算法4得到签名 ![](http://latex.codecogs.com/svg.latex?%5Cinline%20%28r_L%2Cs_L%29),其中私钥见第6节。 + + 要求 ![](http://latex.codecogs.com/svg.latex?%5Cinline%20r_L) 和 ![](http://latex.codecogs.com/svg.latex?%5Cinline%20s_L) 的长度都不得超过240比特,否则重复该步骤。 + +6. 将 ![](http://latex.codecogs.com/svg.latex?%5Cinline%20r_L) 和 ![](http://latex.codecogs.com/svg.latex?%5Cinline%20s_L) 以16进制形式输出(无`"0x"`前缀),分别记为 ![](http://latex.codecogs.com/svg.latex?%5Cinline%20SZ%5E%7Br_L%7D) 和 ![](http://latex.codecogs.com/svg.latex?%5Cinline%20SZ%5E%7Bs_L%7D)。 + + 若长度不满60,则在前面补字符`'0'`,直到长度为60。 + +7. 令字符串 ![Data1-inlined]为 + +

+ +

+ +8. 令字符串 ![Temp-inlined]为 + +

+ +

+ + 对 ![Temp-inlined] 使用算法4得到签名 ![](http://latex.codecogs.com/svg.latex?%5Cinline%20%28r_%7BTemp%7D%2Cs_%7BTemp%7D%29),其中私钥见第6节。 + + 要求 ![](http://latex.codecogs.com/svg.latex?%5Cinline%20r_%7BTemp%7D) 和 ![](http://latex.codecogs.com/svg.latex?%5Cinline%20s_%7BTemp%7D) 的长度都不得超过240比特,否则重复该步骤。 + +9. 将 ![](http://latex.codecogs.com/svg.latex?%5Cinline%20r_%7BTemp%7D) 和 ![](http://latex.codecogs.com/svg.latex?%5Cinline%20s_%7BTemp%7D) 以16进制形式输出(无`"0x"`前缀),分别记为 ![](http://latex.codecogs.com/svg.latex?%5Cinline%20SZ%5E%7Br_%7BTemp%7D%7D) 和 ![](http://latex.codecogs.com/svg.latex?%5Cinline%20SZ%5E%7Bs_%7BTemp%7D%7D)。 + + 若长度不满60,则在前面补字符`'0'`,直到长度为60。 + +10. 令字符串 ![Data2-inlined]为 + +

+ +

+ +11. 对 + +

+ +

+ + 计算CRC32值,最终校验和为CRC32值的反。将校验和以10进制形式输出,若长度不满10,则在前面补字符`'0'`,直到长度为10,记为 ![](http://latex.codecogs.com/svg.latex?%5Cinline%20SZ%5E%7Bchecksum%7D)。 + +12. 令字符串 ![Data-inlined]为 + +

+ +

+ +13. 格式化输出。 + + * 固定文件头`"RAR registration data"`,占一行。 + + * 用户名,占一行。 + + * 授权类型,占一行。 + + * UID,占一行: + +

+ +

+ + * 将 ![Data-inlined] 按照每行54个字符输出。 diff --git a/assets/formula/1-dark.svg b/assets/formula/1-dark.svg new file mode 100644 index 0000000..438b9e2 --- /dev/null +++ b/assets/formula/1-dark.svg @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/1-light.svg b/assets/formula/1-light.svg new file mode 100644 index 0000000..438b9e2 --- /dev/null +++ b/assets/formula/1-light.svg @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/GF2-inlined-dark.svg b/assets/formula/GF2-inlined-dark.svg new file mode 100644 index 0000000..5d75e67 --- /dev/null +++ b/assets/formula/GF2-inlined-dark.svg @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/GF2-inlined-light.svg b/assets/formula/GF2-inlined-light.svg new file mode 100644 index 0000000..6814f5c --- /dev/null +++ b/assets/formula/GF2-inlined-light.svg @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/GF2p15-inlined-dark.svg b/assets/formula/GF2p15-inlined-dark.svg new file mode 100644 index 0000000..f9be827 --- /dev/null +++ b/assets/formula/GF2p15-inlined-dark.svg @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/GF2p15-inlined-light.svg b/assets/formula/GF2p15-inlined-light.svg new file mode 100644 index 0000000..70a4d55 --- /dev/null +++ b/assets/formula/GF2p15-inlined-light.svg @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/GF2p15p17-inlined-dark.svg b/assets/formula/GF2p15p17-inlined-dark.svg new file mode 100644 index 0000000..b5ca082 --- /dev/null +++ b/assets/formula/GF2p15p17-inlined-dark.svg @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/GF2p15p17-inlined-light.svg b/assets/formula/GF2p15p17-inlined-light.svg new file mode 100644 index 0000000..9ddc0c3 --- /dev/null +++ b/assets/formula/GF2p15p17-inlined-light.svg @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/Image display.txt b/assets/formula/Image display.txt new file mode 100644 index 0000000..b23e2cb --- /dev/null +++ b/assets/formula/Image display.txt @@ -0,0 +1 @@ +https://stackoverflow.com/questions/65413712/changing-readme-md-image-display-conditional-to-github-light-mode-dark-mode \ No newline at end of file From d4c1b5638391823fb7a427f5987b7ca6ec18612a Mon Sep 17 00:00:00 2001 From: bitcookies Date: Wed, 9 Feb 2022 21:56:02 +0800 Subject: [PATCH 02/11] Update 1-dark.svg --- assets/formula/1-dark.svg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets/formula/1-dark.svg b/assets/formula/1-dark.svg index 438b9e2..0ccce2d 100644 --- a/assets/formula/1-dark.svg +++ b/assets/formula/1-dark.svg @@ -1,6 +1,6 @@ - + From 70f70d2f6098bd653b5378433fcfa7504419277b Mon Sep 17 00:00:00 2001 From: bitcookies Date: Wed, 9 Feb 2022 21:56:46 +0800 Subject: [PATCH 03/11] Update README.HOW_DOES_IT_WORK.zh-CN.md --- README.HOW_DOES_IT_WORK.zh-CN.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.HOW_DOES_IT_WORK.zh-CN.md b/README.HOW_DOES_IT_WORK.zh-CN.md index ae31d5e..cf9d7da 100644 --- a/README.HOW_DOES_IT_WORK.zh-CN.md +++ b/README.HOW_DOES_IT_WORK.zh-CN.md @@ -10,8 +10,6 @@ WinRAR 使用了基于 ECC 的签名算法来生成 `rarreg.key` 文件,其使

- - 各项系数全部位于 ![GF2p15-inlined](assets/formula/GF2-inlined-light.svg#gh-light-mode-only)![GF2p15-inlined](assets/formula/GF2-inlined-dark.svg#gh-dark-mode-only)。设基域的标准基为:

From 648269e4d1426bc42a4a610e72d3399f2351b110 Mon Sep 17 00:00:00 2001 From: Bit Cookies Date: Wed, 9 Feb 2022 21:58:32 +0800 Subject: [PATCH 04/11] Update README.HOW_DOES_IT_WORK.zh-CN.md --- README.HOW_DOES_IT_WORK.zh-CN.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.HOW_DOES_IT_WORK.zh-CN.md b/README.HOW_DOES_IT_WORK.zh-CN.md index cf9d7da..78eaf05 100644 --- a/README.HOW_DOES_IT_WORK.zh-CN.md +++ b/README.HOW_DOES_IT_WORK.zh-CN.md @@ -4,12 +4,13 @@ WinRAR 使用了基于 ECC 的签名算法来生成 `rarreg.key` 文件,其使 ## 1. 复合域 ![GF2p15p17-inlined](assets/formula/GF2p15p17-inlined-light.svg#gh-light-mode-only) ![GF2p15p17-inlined](assets/formula/GF2p15p17-inlined-dark.svg#gh-dark-mode-only) -基域 ![GF2p15-inlined](assets/formula/GF2p15-inlined-light.svg#gh-light-mode-only)![GF2p15-inlined](assets/formula/GF2p15-inlined-dark.svg#gh-dark-mode-only) 采用标准基(多项式基)来表达,采用的不可约多项式为: +基域 ![GF2p15-inlined](assets/formula/GF2p15-inlined-light.svg#gh-light-mode-only)![GF2p15-inlined](assets/formula/GF2p15-inlined-dark.svg#gh-dark-mode-only) 采用标准基(多项式基)来表达,采用的不可约多项式为:

+ 各项系数全部位于 ![GF2p15-inlined](assets/formula/GF2-inlined-light.svg#gh-light-mode-only)![GF2p15-inlined](assets/formula/GF2-inlined-dark.svg#gh-dark-mode-only)。设基域的标准基为:

From cc95c2344bf2dc47b634831934a28eb5f8ef7fde Mon Sep 17 00:00:00 2001 From: bitcookies Date: Thu, 10 Feb 2022 09:42:43 +0800 Subject: [PATCH 05/11] dark --- README.HOW_DOES_IT_WORK.zh-CN.md | 8 ++++-- assets/formula/2-dark.svg | 38 +++++++++++++++++++++++++++ assets/formula/2-light.svg | 38 +++++++++++++++++++++++++++ assets/formula/3-dark.svg | 44 ++++++++++++++++++++++++++++++++ assets/formula/3-light.svg | 44 ++++++++++++++++++++++++++++++++ 5 files changed, 170 insertions(+), 2 deletions(-) create mode 100644 assets/formula/2-dark.svg create mode 100644 assets/formula/2-light.svg create mode 100644 assets/formula/3-dark.svg create mode 100644 assets/formula/3-light.svg diff --git a/README.HOW_DOES_IT_WORK.zh-CN.md b/README.HOW_DOES_IT_WORK.zh-CN.md index 78eaf05..ddf3d11 100644 --- a/README.HOW_DOES_IT_WORK.zh-CN.md +++ b/README.HOW_DOES_IT_WORK.zh-CN.md @@ -14,15 +14,19 @@ WinRAR 使用了基于 ECC 的签名算法来生成 `rarreg.key` 文件,其使 各项系数全部位于 ![GF2p15-inlined](assets/formula/GF2-inlined-light.svg#gh-light-mode-only)![GF2p15-inlined](assets/formula/GF2-inlined-dark.svg#gh-dark-mode-only)。设基域的标准基为:

- +

+ 则位于基域 ![GF2p15-inlined](assets/formula/GF2p15-inlined-light.svg#gh-light-mode-only)![GF2p15-inlined](assets/formula/GF2p15-inlined-dark.svg#gh-dark-mode-only) 上的元素 ![A-inlined] 可以用如下方式表达:

- +

+ --- 复合域 ![GF2p15p17-inlined](assets/formula/GF2p15p17-inlined-light.svg#gh-light-mode-only) ![GF2p15p17-inlined](assets/formula/GF2p15p17-inlined-dark.svg#gh-dark-mode-only) 的不可约多项式为: diff --git a/assets/formula/2-dark.svg b/assets/formula/2-dark.svg new file mode 100644 index 0000000..7f9ecb5 --- /dev/null +++ b/assets/formula/2-dark.svg @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/2-light.svg b/assets/formula/2-light.svg new file mode 100644 index 0000000..7319885 --- /dev/null +++ b/assets/formula/2-light.svg @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/3-dark.svg b/assets/formula/3-dark.svg new file mode 100644 index 0000000..6fc3de1 --- /dev/null +++ b/assets/formula/3-dark.svg @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/3-light.svg b/assets/formula/3-light.svg new file mode 100644 index 0000000..30ac1e6 --- /dev/null +++ b/assets/formula/3-light.svg @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file From 60810662fe9dc248bc97bf9e48cfad417606bfb0 Mon Sep 17 00:00:00 2001 From: bitcookies Date: Thu, 10 Feb 2022 11:22:11 +0800 Subject: [PATCH 06/11] =?UTF-8?q?=F0=9F=8C=99=20Adapt=20the=20Github=20Dar?= =?UTF-8?q?k=20Theme?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 🌙 Adapt the Github Dark Theme --- README.HOW_DOES_IT_WORK.zh-CN.md | 177 +++++++++++++++---------- assets/formula/10-dark.svg | 96 ++++++++++++++ assets/formula/10-light.svg | 96 ++++++++++++++ assets/formula/11-dark.svg | 48 +++++++ assets/formula/11-light.svg | 48 +++++++ assets/formula/12-dark.svg | 64 ++++++++++ assets/formula/12-light.svg | 64 ++++++++++ assets/formula/13-dark.svg | 29 +++++ assets/formula/13-light.svg | 29 +++++ assets/formula/14-dark.svg | 22 ++++ assets/formula/14-light.svg | 22 ++++ assets/formula/15-dark.svg | 83 ++++++++++++ assets/formula/15-light.svg | 83 ++++++++++++ assets/formula/16-dark.svg | 18 +++ assets/formula/16-light.svg | 18 +++ assets/formula/17-dark.svg | 18 +++ assets/formula/17-light.svg | 18 +++ assets/formula/18-dark.svg | 20 +++ assets/formula/18-light.svg | 20 +++ assets/formula/19-dark.svg | 40 ++++++ assets/formula/19-light.svg | 40 ++++++ assets/formula/20-dark.svg | 24 ++++ assets/formula/20-light.svg | 24 ++++ assets/formula/21-dark.svg | 18 +++ assets/formula/21-light.svg | 18 +++ assets/formula/22-dark.svg | 14 ++ assets/formula/22-light.svg | 14 ++ assets/formula/23-dark.svg | 21 +++ assets/formula/23-light.svg | 21 +++ assets/formula/24-dark.svg | 34 +++++ assets/formula/24-light.svg | 34 +++++ assets/formula/25-dark.svg | 14 ++ assets/formula/25-light.svg | 14 ++ assets/formula/26-dark.svg | 48 +++++++ assets/formula/26-light.svg | 48 +++++++ assets/formula/27-dark.svg | 33 +++++ assets/formula/27-light.svg | 33 +++++ assets/formula/28-dark.svg | 55 ++++++++ assets/formula/28-light.svg | 55 ++++++++ assets/formula/29-dark.svg | 16 +++ assets/formula/29-light.svg | 16 +++ assets/formula/30-dark.svg | 16 +++ assets/formula/30-light.svg | 16 +++ assets/formula/31-dark.svg | 12 ++ assets/formula/31-light.svg | 12 ++ assets/formula/32-dark.svg | 16 +++ assets/formula/32-light.svg | 16 +++ assets/formula/33-dark.svg | 75 +++++++++++ assets/formula/33-light.svg | 75 +++++++++++ assets/formula/34-dark.svg | 14 ++ assets/formula/34-light.svg | 14 ++ assets/formula/35-dark.svg | 97 ++++++++++++++ assets/formula/35-light.svg | 97 ++++++++++++++ assets/formula/36-dark.svg | 12 ++ assets/formula/36-light.svg | 12 ++ assets/formula/37-dark.svg | 113 ++++++++++++++++ assets/formula/37-light.svg | 113 ++++++++++++++++ assets/formula/38-dark.svg | 12 ++ assets/formula/38-light.svg | 12 ++ assets/formula/39-dark.svg | 14 ++ assets/formula/39-light.svg | 14 ++ assets/formula/4-dark.svg | 31 +++++ assets/formula/4-light.svg | 31 +++++ assets/formula/40-dark.svg | 31 +++++ assets/formula/40-light.svg | 31 +++++ assets/formula/41-dark.svg | 33 +++++ assets/formula/41-light.svg | 33 +++++ assets/formula/42-dark.svg | 95 ++++++++++++++ assets/formula/42-light.svg | 95 ++++++++++++++ assets/formula/43-dark.svg | 213 +++++++++++++++++++++++++++++++ assets/formula/43-light.svg | 213 +++++++++++++++++++++++++++++++ assets/formula/44-dark.svg | 29 +++++ assets/formula/44-light.svg | 29 +++++ assets/formula/45-dark.svg | 29 +++++ assets/formula/45-light.svg | 29 +++++ assets/formula/46-dark.svg | 12 ++ assets/formula/46-light.svg | 12 ++ assets/formula/47-dark.svg | 12 ++ assets/formula/47-light.svg | 12 ++ assets/formula/48-dark.svg | 63 +++++++++ assets/formula/48-light.svg | 63 +++++++++ assets/formula/49-dark.svg | 19 +++ assets/formula/49-light.svg | 19 +++ assets/formula/5-dark.svg | 38 ++++++ assets/formula/5-light.svg | 38 ++++++ assets/formula/50-dark.svg | 19 +++ assets/formula/50-light.svg | 19 +++ assets/formula/51-dark.svg | 91 +++++++++++++ assets/formula/51-light.svg | 91 +++++++++++++ assets/formula/52-dark.svg | 21 +++ assets/formula/52-light.svg | 21 +++ assets/formula/53-dark.svg | 12 ++ assets/formula/53-light.svg | 12 ++ assets/formula/54-dark.svg | 12 ++ assets/formula/54-light.svg | 12 ++ assets/formula/55-dark.svg | 16 +++ assets/formula/55-light.svg | 16 +++ assets/formula/56-dark.svg | 16 +++ assets/formula/56-light.svg | 16 +++ assets/formula/57-dark.svg | 44 +++++++ assets/formula/57-light.svg | 44 +++++++ assets/formula/58-dark.svg | 32 +++++ assets/formula/58-light.svg | 32 +++++ assets/formula/59-dark.svg | 30 +++++ assets/formula/59-light.svg | 30 +++++ assets/formula/6-dark.svg | 83 ++++++++++++ assets/formula/6-light.svg | 83 ++++++++++++ assets/formula/60-dark.svg | 18 +++ assets/formula/60-light.svg | 18 +++ assets/formula/61-dark.svg | 18 +++ assets/formula/61-light.svg | 18 +++ assets/formula/62-dark.svg | 22 ++++ assets/formula/62-light.svg | 22 ++++ assets/formula/63-dark.svg | 22 ++++ assets/formula/63-light.svg | 22 ++++ assets/formula/64-dark.svg | 53 ++++++++ assets/formula/64-light.svg | 53 ++++++++ assets/formula/65-dark.svg | 50 ++++++++ assets/formula/65-light.svg | 50 ++++++++ assets/formula/66-dark.svg | 27 ++++ assets/formula/66-light.svg | 27 ++++ assets/formula/67-dark.svg | 69 ++++++++++ assets/formula/67-light.svg | 69 ++++++++++ assets/formula/68-dark.svg | 28 ++++ assets/formula/68-light.svg | 28 ++++ assets/formula/7-dark.svg | 76 +++++++++++ assets/formula/7-light.svg | 76 +++++++++++ assets/formula/8-dark.svg | 52 ++++++++ assets/formula/8-light.svg | 52 ++++++++ assets/formula/9-dark.svg | 213 +++++++++++++++++++++++++++++++ assets/formula/9-light.svg | 213 +++++++++++++++++++++++++++++++ 131 files changed, 5563 insertions(+), 64 deletions(-) create mode 100644 assets/formula/10-dark.svg create mode 100644 assets/formula/10-light.svg create mode 100644 assets/formula/11-dark.svg create mode 100644 assets/formula/11-light.svg create mode 100644 assets/formula/12-dark.svg create mode 100644 assets/formula/12-light.svg create mode 100644 assets/formula/13-dark.svg create mode 100644 assets/formula/13-light.svg create mode 100644 assets/formula/14-dark.svg create mode 100644 assets/formula/14-light.svg create mode 100644 assets/formula/15-dark.svg create mode 100644 assets/formula/15-light.svg create mode 100644 assets/formula/16-dark.svg create mode 100644 assets/formula/16-light.svg create mode 100644 assets/formula/17-dark.svg create mode 100644 assets/formula/17-light.svg create mode 100644 assets/formula/18-dark.svg create mode 100644 assets/formula/18-light.svg create mode 100644 assets/formula/19-dark.svg create mode 100644 assets/formula/19-light.svg create mode 100644 assets/formula/20-dark.svg create mode 100644 assets/formula/20-light.svg create mode 100644 assets/formula/21-dark.svg create mode 100644 assets/formula/21-light.svg create mode 100644 assets/formula/22-dark.svg create mode 100644 assets/formula/22-light.svg create mode 100644 assets/formula/23-dark.svg create mode 100644 assets/formula/23-light.svg create mode 100644 assets/formula/24-dark.svg create mode 100644 assets/formula/24-light.svg create mode 100644 assets/formula/25-dark.svg create mode 100644 assets/formula/25-light.svg create mode 100644 assets/formula/26-dark.svg create mode 100644 assets/formula/26-light.svg create mode 100644 assets/formula/27-dark.svg create mode 100644 assets/formula/27-light.svg create mode 100644 assets/formula/28-dark.svg create mode 100644 assets/formula/28-light.svg create mode 100644 assets/formula/29-dark.svg create mode 100644 assets/formula/29-light.svg create mode 100644 assets/formula/30-dark.svg create mode 100644 assets/formula/30-light.svg create mode 100644 assets/formula/31-dark.svg create mode 100644 assets/formula/31-light.svg create mode 100644 assets/formula/32-dark.svg create mode 100644 assets/formula/32-light.svg create mode 100644 assets/formula/33-dark.svg create mode 100644 assets/formula/33-light.svg create mode 100644 assets/formula/34-dark.svg create mode 100644 assets/formula/34-light.svg create mode 100644 assets/formula/35-dark.svg create mode 100644 assets/formula/35-light.svg create mode 100644 assets/formula/36-dark.svg create mode 100644 assets/formula/36-light.svg create mode 100644 assets/formula/37-dark.svg create mode 100644 assets/formula/37-light.svg create mode 100644 assets/formula/38-dark.svg create mode 100644 assets/formula/38-light.svg create mode 100644 assets/formula/39-dark.svg create mode 100644 assets/formula/39-light.svg create mode 100644 assets/formula/4-dark.svg create mode 100644 assets/formula/4-light.svg create mode 100644 assets/formula/40-dark.svg create mode 100644 assets/formula/40-light.svg create mode 100644 assets/formula/41-dark.svg create mode 100644 assets/formula/41-light.svg create mode 100644 assets/formula/42-dark.svg create mode 100644 assets/formula/42-light.svg create mode 100644 assets/formula/43-dark.svg create mode 100644 assets/formula/43-light.svg create mode 100644 assets/formula/44-dark.svg create mode 100644 assets/formula/44-light.svg create mode 100644 assets/formula/45-dark.svg create mode 100644 assets/formula/45-light.svg create mode 100644 assets/formula/46-dark.svg create mode 100644 assets/formula/46-light.svg create mode 100644 assets/formula/47-dark.svg create mode 100644 assets/formula/47-light.svg create mode 100644 assets/formula/48-dark.svg create mode 100644 assets/formula/48-light.svg create mode 100644 assets/formula/49-dark.svg create mode 100644 assets/formula/49-light.svg create mode 100644 assets/formula/5-dark.svg create mode 100644 assets/formula/5-light.svg create mode 100644 assets/formula/50-dark.svg create mode 100644 assets/formula/50-light.svg create mode 100644 assets/formula/51-dark.svg create mode 100644 assets/formula/51-light.svg create mode 100644 assets/formula/52-dark.svg create mode 100644 assets/formula/52-light.svg create mode 100644 assets/formula/53-dark.svg create mode 100644 assets/formula/53-light.svg create mode 100644 assets/formula/54-dark.svg create mode 100644 assets/formula/54-light.svg create mode 100644 assets/formula/55-dark.svg create mode 100644 assets/formula/55-light.svg create mode 100644 assets/formula/56-dark.svg create mode 100644 assets/formula/56-light.svg create mode 100644 assets/formula/57-dark.svg create mode 100644 assets/formula/57-light.svg create mode 100644 assets/formula/58-dark.svg create mode 100644 assets/formula/58-light.svg create mode 100644 assets/formula/59-dark.svg create mode 100644 assets/formula/59-light.svg create mode 100644 assets/formula/6-dark.svg create mode 100644 assets/formula/6-light.svg create mode 100644 assets/formula/60-dark.svg create mode 100644 assets/formula/60-light.svg create mode 100644 assets/formula/61-dark.svg create mode 100644 assets/formula/61-light.svg create mode 100644 assets/formula/62-dark.svg create mode 100644 assets/formula/62-light.svg create mode 100644 assets/formula/63-dark.svg create mode 100644 assets/formula/63-light.svg create mode 100644 assets/formula/64-dark.svg create mode 100644 assets/formula/64-light.svg create mode 100644 assets/formula/65-dark.svg create mode 100644 assets/formula/65-light.svg create mode 100644 assets/formula/66-dark.svg create mode 100644 assets/formula/66-light.svg create mode 100644 assets/formula/67-dark.svg create mode 100644 assets/formula/67-light.svg create mode 100644 assets/formula/68-dark.svg create mode 100644 assets/formula/68-light.svg create mode 100644 assets/formula/7-dark.svg create mode 100644 assets/formula/7-light.svg create mode 100644 assets/formula/8-dark.svg create mode 100644 assets/formula/8-light.svg create mode 100644 assets/formula/9-dark.svg create mode 100644 assets/formula/9-light.svg diff --git a/README.HOW_DOES_IT_WORK.zh-CN.md b/README.HOW_DOES_IT_WORK.zh-CN.md index ddf3d11..c47bb32 100644 --- a/README.HOW_DOES_IT_WORK.zh-CN.md +++ b/README.HOW_DOES_IT_WORK.zh-CN.md @@ -32,150 +32,183 @@ WinRAR 使用了基于 ECC 的签名算法来生成 `rarreg.key` 文件,其使 复合域 ![GF2p15p17-inlined](assets/formula/GF2p15p17-inlined-light.svg#gh-light-mode-only) ![GF2p15p17-inlined](assets/formula/GF2p15p17-inlined-dark.svg#gh-dark-mode-only) 的不可约多项式为:

- +

+ 各项系数全部位于 ![GF2p15-inlined](assets/formula/GF2p15-inlined-light.svg#gh-light-mode-only)![GF2p15-inlined](assets/formula/GF2p15-inlined-dark.svg#gh-dark-mode-only)。设复合域的标准基为:

- +

+ 则位于复合域 ![GF2p15p17-inlined](assets/formula/GF2p15p17-inlined-light.svg#gh-light-mode-only) ![GF2p15p17-inlined](assets/formula/GF2p15p17-inlined-dark.svg#gh-dark-mode-only) 上的元素 ![B-inlined] 可以用如下方式表达:

- +

+ --- 为了方便表述我们用255比特的大数 ![D-inlined] 来表示位于复合域 ![GF2p15p17-inlined](assets/formula/GF2p15p17-inlined-light.svg#gh-light-mode-only) ![GF2p15p17-inlined](assets/formula/GF2p15p17-inlined-dark.svg#gh-dark-mode-only) 上的元素 ![B-inlined]。它们的对应关系为:

- +

+ ## 2. 复合域 ![GF2p15p17-inlined] 上的椭圆曲线 曲线方程为:

- +

+ 基点 ![G-inlined] 为:

- +

+ 基点 ![G-inlined] 的阶 ![n-inlined] 为:

- +

+ ## 3. 消息哈希算法 设长度为 ![l-inlined] 的消息为:

- +

+ 则消息 ![M-inlined] 的SHA1值为:

- +

-其中 ![](http://latex.codecogs.com/svg.latex?%5Cinline%20S_0%2CS_1%2CS_2%2CS_3%2CS_4) 为SHA1算法输出时的5个状态值;将这5个状态值按照大端字节序依次输出,即为的SHA1哈希值 ![](http://latex.codecogs.com/svg.latex?%5Cinline%20%5Ctextrm%7BSHA%7D_1%28M%29)。 -WinRAR在做完SHA1计算后,采用大数 ![h-inlined] 作为ECC签名时消息的哈希: +其中 ![s0,4](assets/formula/13-light.svg#gh-light-mode-only)![s0,4](assets/formula/13-dark.svg#gh-dark-mode-only) 为SHA1算法输出时的5个状态值;将这5个状态值按照大端字节序依次输出,即为的SHA1哈希值 ![SHA1M](assets/formula/14-light.svg#gh-light-mode-only)![SHA1M](assets/formula/14-dark.svg#gh-dark-mode-only)。 + +WinRAR 在做完 SHA1 计算后,采用大数 ![h-inlined] 作为 ECC 签名时消息的哈希:

- +

- ## 4. ECC签名算法 设私钥为 ![k-inlined],公钥为 ![P-inlined],即:

- +

-消息哈希为 ![h-inlined],则签名 ![](http://latex.codecogs.com/svg.latex?%5Cinline%20%28r%2Cs%29) 为: -1. 生成随机数 ![Rnd-inlined],满足 ![](http://latex.codecogs.com/svg.latex?%5Cinline%200%3CRnd%3Cn)。 +消息哈希为 ![h-inlined],则签名 ![(r,s)](assets/formula/17-light.svg#gh-light-mode-only)![(r,s)](assets/formula/17-dark.svg#gh-dark-mode-only) 为: + +1. 生成随机数 ![Rnd-inlined],满足 ![RND](assets/formula/18-light.svg#gh-light-mode-only)![RND](assets/formula/18-dark.svg#gh-dark-mode-only)。 2. 计算 ![r-inlined]

- + +

- 其中 ![](http://latex.codecogs.com/svg.latex?%5Cinline%20%28Rnd%20%5Ccdot%20G%29_x) 表示取 ![](http://latex.codecogs.com/svg.latex?%5Cinline%20Rnd%20%5Ccdot%20G) 的X坐标,同时将X坐标从 ![GF2p15p17-inlined] 转换为大数。 - 若 ![](http://latex.codecogs.com/svg.latex?%5Cinline%20r%3D0) 或者 ![](http://latex.codecogs.com/svg.latex?%5Cinline%20r+Rnd%3Dn) 则回到步骤1。 + 其中 ![RNDGx](assets/formula/20-light.svg#gh-light-mode-only)![RNDGx](assets/formula/20-dark.svg#gh-dark-mode-only) 表示取 ![RNDG](assets/formula/21-light.svg#gh-light-mode-only)![RNDG](assets/formula/21-dark.svg#gh-dark-mode-only) 的 X 坐标,同时将 X 坐标从 !![GF2p15p17-inlined](assets/formula/GF2p15p17-inlined-light.svg#gh-light-mode-only) ![GF2p15p17-inlined](assets/formula/GF2p15p17-inlined-dark.svg#gh-dark-mode-only) 转换为大数。 + + 若 ![r=0](assets/formula/22-light.svg#gh-light-mode-only)![r=0](assets/formula/22-dark.svg#gh-dark-mode-only) 或者 ![rRnd](assets/formula/23-light.svg#gh-light-mode-only)![rRnd](assets/formula/23-dark.svg#gh-dark-mode-only) 则回到步骤1。 3. 计算 ![s-inlined]

- + +

- 若 ![](http://latex.codecogs.com/svg.latex?%5Cinline%20s%3D0) 则回到步骤1。 -4. 输出 ![](http://latex.codecogs.com/svg.latex?%5Cinline%20%28r%2Cs%29)。 + 若 ![s=0](assets/formula/25-light.svg#gh-light-mode-only)![s=0](assets/formula/25-dark.svg#gh-dark-mode-only) 则回到步骤1。 + +4. 输出 ![(r,s)](assets/formula/17-light.svg#gh-light-mode-only)![(r,s)](assets/formula/17-dark.svg#gh-dark-mode-only)。 ## 5. WinRAR的私钥生成算法 该算法会利用长度为 ![l-inlined] 的数据

- + +

+ 来生成私钥 ![k-inlined]。 -1. 设6个32位整数为 ![](http://latex.codecogs.com/svg.latex?%5Cinline%20g_0%2Cg_1%2Cg_2%2Cg_3%2Cg_4%2Cg_5),则有 +1. 设6个32位整数为 ![g0-5](assets/formula/27-light.svg#gh-light-mode-only)![g0-5](assets/formula/27-dark.svg#gh-dark-mode-only),则有

- + +

-2. 令 ![](http://latex.codecogs.com/svg.latex?%5Cinline%20g_0%3D0)。 +2. 令 ![g0=0](assets/formula/29-light.svg#gh-light-mode-only)![g0=0](assets/formula/29-dark.svg#gh-dark-mode-only)。 -3. 如果 ![](http://latex.codecogs.com/svg.latex?%5Cinline%20l%5Cneq%200) 则计算 ![T-inlined] 的SHA1值,并将状态值 ![](http://latex.codecogs.com/svg.latex?%5Cinline%20S_i) 赋值给 ![](http://latex.codecogs.com/svg.latex?%5Cinline%20g_%7Bi+1%7D): +3. 如果 ![l!=0](assets/formula/30-light.svg#gh-light-mode-only)![l!=0](assets/formula/30-dark.svg#gh-dark-mode-only) 则计算 ![T-inlined] 的 SHA1 值,并将状态值 ![Si](assets/formula/31-light.svg#gh-light-mode-only)![Si](assets/formula/31-dark.svg#gh-dark-mode-only) 赋值给 ![gi+1](assets/formula/32-light.svg#gh-light-mode-only)![gi+1](assets/formula/32-dark.svg#gh-dark-mode-only):

- + +

- 否则,即 ![](http://latex.codecogs.com/svg.latex?%5Cinline%20l%3D0) 时,令: + + 否则,即 ![l=0](assets/formula/34-light.svg#gh-light-mode-only)![l=0](assets/formula/34-dark.svg#gh-dark-mode-only) 时,令:

- + +

-4. 把 ![](http://latex.codecogs.com/svg.latex?%5Cinline%20g_0) 作为计数器,自增1。 +4. 把 ![g0](assets/formula/36-light.svg#gh-light-mode-only)![g0](assets/formula/36-dark.svg#gh-dark-mode-only) 作为计数器,自增1。 - 计算SHA1值: + 计算 SHA1 值:

- + +

- 取 ![](http://latex.codecogs.com/svg.latex?%5Cinline%20S_0) 的低16位并记为 ![](http://latex.codecogs.com/svg.latex?%5Cinline%20k_%7Bg_0%7D)。 + + 取 ![S0](assets/formula/38-light.svg#gh-light-mode-only)![S0](assets/formula/38-dark.svg#gh-dark-mode-only) 的低16位并记为 ![Kg0](assets/formula/39-light.svg#gh-light-mode-only)![Kg0](assets/formula/39-dark.svg#gh-dark-mode-only)。 5. 步骤4再重复14次。 -6. 重复执行完后会得到 ![](http://latex.codecogs.com/svg.latex?%5Cinline%20k_1%2Ck_2%2Ck_3%2C%5Cldots%2Ck_%7B15%7D),则输出私钥 +6. 重复执行完后会得到 ![k1-15](assets/formula/40-light.svg#gh-light-mode-only)![k1-15](assets/formula/40-dark.svg#gh-dark-mode-only),则输出私钥

- + +

## 6. WinRAR的公钥和私钥 @@ -183,106 +216,121 @@ WinRAR在做完SHA1计算后,采用大数 ![h-inlined] 作为ECC签名时消 WinRAR的私钥 ![k-inlined] 为:

- + +

+ 该私钥是通过算法5生成的,其中数据 ![T-inlined] 的长度为0。 公钥 ![P-inlined] 为:

- + +

+ ## 7. 授权文件"rarreg.key"的生成 授权文件的生成需要两个参数: -1. 用户名的ANSI字符串,不包括null-terminator;记为 +1. 用户名的 ANSI 字符串,不包括 null-terminator;记为

- + +

-2. 授权类型的ANSI字符串,不包括null-terminator;记为 +2. 授权类型的 ANSI 字符串,不包括 null-terminator;记为

- + +

`rarreg.key` 的生成算法如下: -1. 使用用户名 ![UU-inlined] 通过算法5计算出私钥 ![](http://latex.codecogs.com/svg.latex?%5Cinline%20k_U) 以及公钥 ![](http://latex.codecogs.com/svg.latex?%5Cinline%20P_U),并将公钥 ![](http://latex.codecogs.com/svg.latex?%5Cinline%20P_U) 按照SM2压缩公钥格式以Hex字符串(ASCII编码)的形式输出。得到的Hex字符串记为临时值 ![Temp-inlined]。 +1. 使用用户名 ![UU-inlined] 通过算法5计算出私钥 ![ku](assets/formula/46-light.svg#gh-light-mode-only)![ku](assets/formula/46-dark.svg#gh-dark-mode-only) 以及公钥 ![pu](assets/formula/47-light.svg#gh-light-mode-only)![pu](assets/formula/47-dark.svg#gh-dark-mode-only),并将公钥 ![pu](assets/formula/47-light.svg#gh-light-mode-only)![pu](assets/formula/47-dark.svg#gh-dark-mode-only) 按照 SM2 压缩公钥格式以Hex字符串(ASCII编码)的形式输出。得到的 Hex 字符串记为临时值 ![Temp-inlined]。 - ![Temp-inlined] 的长度应该为64;若长度不足,则在前面补字符`'0'`,直到长度为64。 + ![Temp-inlined] 的长度应该为64;若长度不足,则在前面补字符 `'0'`,直到长度为64。 2. 令字符串 ![Data3-inlined]为

- + +

-3. 使用 ![Data3-inlined] 通过算法5计算出私钥 ![](http://latex.codecogs.com/svg.latex?%5Cinline%20k_%7BData%5E3%7D) 以及公钥 ![](http://latex.codecogs.com/svg.latex?%5Cinline%20P_%7BData%5E3%7D),并将公钥 ![](http://latex.codecogs.com/svg.latex?%5Cinline%20P_%7BData%5E3%7D) 按照SM2压缩公钥格式以Hex字符串(ASCII编码)的形式输出。得到的Hex字符串记为 ![Data0-inlined]。 +3. 使用 ![Data3-inlined] 通过算法5计算出私钥 ![kdata3](assets/formula/49-light.svg#gh-light-mode-only)![kdata3](assets/formula/49-dark.svg#gh-dark-mode-only) 以及公钥 ![pdata3](assets/formula/50-light.svg#gh-light-mode-only)![pdata3](assets/formula/50-dark.svg#gh-dark-mode-only),并将公钥 ![pdata3](assets/formula/50-light.svg#gh-light-mode-only)![pdata3](assets/formula/50-dark.svg#gh-dark-mode-only) 按照 SM2 压缩公钥格式以 Hex 字符串(ASCII编码)的形式输出。得到的Hex字符串记为 ![Data0-inlined]。 ![Data0-inlined] 的长度应该为64;若长度不足,则在前面补字符`'0'`,直到长度为64。 4. 令字符串 ![UID-inlined]为

- + +

-5. 对授权类型 ![LL-inlined] 使用算法4得到签名 ![](http://latex.codecogs.com/svg.latex?%5Cinline%20%28r_L%2Cs_L%29),其中私钥见第6节。 +5. 对授权类型 ![LL-inlined] 使用算法4得到签名 ![(rl,sl)](assets/formula/52-light.svg#gh-light-mode-only)![(rl,sl)](assets/formula/52-dark.svg#gh-dark-mode-only),其中私钥见第6节。 - 要求 ![](http://latex.codecogs.com/svg.latex?%5Cinline%20r_L) 和 ![](http://latex.codecogs.com/svg.latex?%5Cinline%20s_L) 的长度都不得超过240比特,否则重复该步骤。 + 要求 ![rl](assets/formula/53-light.svg#gh-light-mode-only)![rl](assets/formula/53-dark.svg#gh-dark-mode-only) 和 ![sl](assets/formula/54-light.svg#gh-light-mode-only)![sl](assets/formula/54-dark.svg#gh-dark-mode-only) 的长度都不得超过240比特,否则重复该步骤。 -6. 将 ![](http://latex.codecogs.com/svg.latex?%5Cinline%20r_L) 和 ![](http://latex.codecogs.com/svg.latex?%5Cinline%20s_L) 以16进制形式输出(无`"0x"`前缀),分别记为 ![](http://latex.codecogs.com/svg.latex?%5Cinline%20SZ%5E%7Br_L%7D) 和 ![](http://latex.codecogs.com/svg.latex?%5Cinline%20SZ%5E%7Bs_L%7D)。 +6. 将 ![rl](assets/formula/53-light.svg#gh-light-mode-only)![rl](assets/formula/53-dark.svg#gh-dark-mode-only) 和 ![sl](assets/formula/54-light.svg#gh-light-mode-only)![sl](assets/formula/54-dark.svg#gh-dark-mode-only) 以16进制形式输出(无`"0x"`前缀),分别记为 ![SZrl](assets/formula/55-light.svg#gh-light-mode-only)![SZrl](assets/formula/55-dark.svg#gh-dark-mode-only) 和 ![SZsl](assets/formula/56-light.svg#gh-light-mode-only)![SZsl](assets/formula/56-dark.svg#gh-dark-mode-only)。 - 若长度不满60,则在前面补字符`'0'`,直到长度为60。 + 若长度不满60,则在前面补字符 `'0'`,直到长度为60。 7. 令字符串 ![Data1-inlined]为

- + +

8. 令字符串 ![Temp-inlined]为

- + +

- 对 ![Temp-inlined] 使用算法4得到签名 ![](http://latex.codecogs.com/svg.latex?%5Cinline%20%28r_%7BTemp%7D%2Cs_%7BTemp%7D%29),其中私钥见第6节。 - - 要求 ![](http://latex.codecogs.com/svg.latex?%5Cinline%20r_%7BTemp%7D) 和 ![](http://latex.codecogs.com/svg.latex?%5Cinline%20s_%7BTemp%7D) 的长度都不得超过240比特,否则重复该步骤。 -9. 将 ![](http://latex.codecogs.com/svg.latex?%5Cinline%20r_%7BTemp%7D) 和 ![](http://latex.codecogs.com/svg.latex?%5Cinline%20s_%7BTemp%7D) 以16进制形式输出(无`"0x"`前缀),分别记为 ![](http://latex.codecogs.com/svg.latex?%5Cinline%20SZ%5E%7Br_%7BTemp%7D%7D) 和 ![](http://latex.codecogs.com/svg.latex?%5Cinline%20SZ%5E%7Bs_%7BTemp%7D%7D)。 + 对 ![Temp-inlined] 使用算法4得到签名 ![(rTemp,sTemp)](assets/formula/59-light.svg#gh-light-mode-only)![(rTemp,sTemp)](assets/formula/59-dark.svg#gh-dark-mode-only),其中私钥见第6节。 + + 要求 ![rTemp](assets/formula/60-light.svg#gh-light-mode-only)![rTemp](assets/formula/60-dark.svg#gh-dark-mode-only) 和 ![sTemp](assets/formula/61-light.svg#gh-light-mode-only)![sTemp](assets/formula/61-dark.svg#gh-dark-mode-only) 的长度都不得超过240比特,否则重复该步骤。 + +9. 将 ![rTemp](assets/formula/60-light.svg#gh-light-mode-only)![rTemp](assets/formula/60-dark.svg#gh-dark-mode-only) 和 ![sTemp](assets/formula/61-light.svg#gh-light-mode-only)![sTemp](assets/formula/61-dark.svg#gh-dark-mode-only) 以16进制形式输出(无`"0x"`前缀),分别记为 ![SZrTemp](assets/formula/62-light.svg#gh-light-mode-only)![SZrTemp](assets/formula/62-dark.svg#gh-dark-mode-only) 和 ![SZsTemp](assets/formula/63-light.svg#gh-light-mode-only)![SZsTemp](assets/formula/63-dark.svg#gh-dark-mode-only)。 若长度不满60,则在前面补字符`'0'`,直到长度为60。 10. 令字符串 ![Data2-inlined]为

- + +

11. 对

- + +

- 计算CRC32值,最终校验和为CRC32值的反。将校验和以10进制形式输出,若长度不满10,则在前面补字符`'0'`,直到长度为10,记为 ![](http://latex.codecogs.com/svg.latex?%5Cinline%20SZ%5E%7Bchecksum%7D)。 + + 计算 CRC32 值,最终校验和为 CRC32 值的反。将校验和以10进制形式输出,若长度不满10,则在前面补字符 `'0'`,直到长度为10,记为 ![SZchecksum](assets/formula/66-light.svg#gh-light-mode-only)![SZchecksum](assets/formula/66-dark.svg#gh-dark-mode-only)。 12. 令字符串 ![Data-inlined]为

- + +

13. 格式化输出。 - * 固定文件头`"RAR registration data"`,占一行。 + * 固定文件头 `"RAR registration data"`,占一行。 * 用户名,占一行。 @@ -291,7 +339,8 @@ WinRAR的私钥 ![k-inlined] 为: * UID,占一行:

- + +

- + * 将 ![Data-inlined] 按照每行54个字符输出。 diff --git a/assets/formula/10-dark.svg b/assets/formula/10-dark.svg new file mode 100644 index 0000000..3ddfeb6 --- /dev/null +++ b/assets/formula/10-dark.svg @@ -0,0 +1,96 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/10-light.svg b/assets/formula/10-light.svg new file mode 100644 index 0000000..c3b1e49 --- /dev/null +++ b/assets/formula/10-light.svg @@ -0,0 +1,96 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/11-dark.svg b/assets/formula/11-dark.svg new file mode 100644 index 0000000..28968f5 --- /dev/null +++ b/assets/formula/11-dark.svg @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/11-light.svg b/assets/formula/11-light.svg new file mode 100644 index 0000000..61c5521 --- /dev/null +++ b/assets/formula/11-light.svg @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/12-dark.svg b/assets/formula/12-dark.svg new file mode 100644 index 0000000..a7172ba --- /dev/null +++ b/assets/formula/12-dark.svg @@ -0,0 +1,64 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/12-light.svg b/assets/formula/12-light.svg new file mode 100644 index 0000000..8a1922e --- /dev/null +++ b/assets/formula/12-light.svg @@ -0,0 +1,64 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/13-dark.svg b/assets/formula/13-dark.svg new file mode 100644 index 0000000..37907db --- /dev/null +++ b/assets/formula/13-dark.svg @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/13-light.svg b/assets/formula/13-light.svg new file mode 100644 index 0000000..47ccb72 --- /dev/null +++ b/assets/formula/13-light.svg @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/14-dark.svg b/assets/formula/14-dark.svg new file mode 100644 index 0000000..2a1bf9e --- /dev/null +++ b/assets/formula/14-dark.svg @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/14-light.svg b/assets/formula/14-light.svg new file mode 100644 index 0000000..dfcc2a1 --- /dev/null +++ b/assets/formula/14-light.svg @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/15-dark.svg b/assets/formula/15-dark.svg new file mode 100644 index 0000000..757a52c --- /dev/null +++ b/assets/formula/15-dark.svg @@ -0,0 +1,83 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/15-light.svg b/assets/formula/15-light.svg new file mode 100644 index 0000000..d5c5c71 --- /dev/null +++ b/assets/formula/15-light.svg @@ -0,0 +1,83 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/16-dark.svg b/assets/formula/16-dark.svg new file mode 100644 index 0000000..a27f1b5 --- /dev/null +++ b/assets/formula/16-dark.svg @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/16-light.svg b/assets/formula/16-light.svg new file mode 100644 index 0000000..b8d1d3f --- /dev/null +++ b/assets/formula/16-light.svg @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/17-dark.svg b/assets/formula/17-dark.svg new file mode 100644 index 0000000..9c77315 --- /dev/null +++ b/assets/formula/17-dark.svg @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/17-light.svg b/assets/formula/17-light.svg new file mode 100644 index 0000000..9c77315 --- /dev/null +++ b/assets/formula/17-light.svg @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/18-dark.svg b/assets/formula/18-dark.svg new file mode 100644 index 0000000..a89e97b --- /dev/null +++ b/assets/formula/18-dark.svg @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/18-light.svg b/assets/formula/18-light.svg new file mode 100644 index 0000000..a89e97b --- /dev/null +++ b/assets/formula/18-light.svg @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/19-dark.svg b/assets/formula/19-dark.svg new file mode 100644 index 0000000..77a7824 --- /dev/null +++ b/assets/formula/19-dark.svg @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/19-light.svg b/assets/formula/19-light.svg new file mode 100644 index 0000000..77a7824 --- /dev/null +++ b/assets/formula/19-light.svg @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/20-dark.svg b/assets/formula/20-dark.svg new file mode 100644 index 0000000..0afae8a --- /dev/null +++ b/assets/formula/20-dark.svg @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/20-light.svg b/assets/formula/20-light.svg new file mode 100644 index 0000000..7de076b --- /dev/null +++ b/assets/formula/20-light.svg @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/21-dark.svg b/assets/formula/21-dark.svg new file mode 100644 index 0000000..02c5007 --- /dev/null +++ b/assets/formula/21-dark.svg @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/21-light.svg b/assets/formula/21-light.svg new file mode 100644 index 0000000..f524280 --- /dev/null +++ b/assets/formula/21-light.svg @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/22-dark.svg b/assets/formula/22-dark.svg new file mode 100644 index 0000000..a0f48b8 --- /dev/null +++ b/assets/formula/22-dark.svg @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/22-light.svg b/assets/formula/22-light.svg new file mode 100644 index 0000000..4fac3f6 --- /dev/null +++ b/assets/formula/22-light.svg @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/23-dark.svg b/assets/formula/23-dark.svg new file mode 100644 index 0000000..fb9e57c --- /dev/null +++ b/assets/formula/23-dark.svg @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/23-light.svg b/assets/formula/23-light.svg new file mode 100644 index 0000000..2977122 --- /dev/null +++ b/assets/formula/23-light.svg @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/24-dark.svg b/assets/formula/24-dark.svg new file mode 100644 index 0000000..c498a5a --- /dev/null +++ b/assets/formula/24-dark.svg @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/24-light.svg b/assets/formula/24-light.svg new file mode 100644 index 0000000..b4fd30d --- /dev/null +++ b/assets/formula/24-light.svg @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/25-dark.svg b/assets/formula/25-dark.svg new file mode 100644 index 0000000..e5a40b6 --- /dev/null +++ b/assets/formula/25-dark.svg @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/25-light.svg b/assets/formula/25-light.svg new file mode 100644 index 0000000..d73adee --- /dev/null +++ b/assets/formula/25-light.svg @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/26-dark.svg b/assets/formula/26-dark.svg new file mode 100644 index 0000000..5fb023b --- /dev/null +++ b/assets/formula/26-dark.svg @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/26-light.svg b/assets/formula/26-light.svg new file mode 100644 index 0000000..b0c5bee --- /dev/null +++ b/assets/formula/26-light.svg @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/27-dark.svg b/assets/formula/27-dark.svg new file mode 100644 index 0000000..f931783 --- /dev/null +++ b/assets/formula/27-dark.svg @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/27-light.svg b/assets/formula/27-light.svg new file mode 100644 index 0000000..eb09b01 --- /dev/null +++ b/assets/formula/27-light.svg @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/28-dark.svg b/assets/formula/28-dark.svg new file mode 100644 index 0000000..fe40fb3 --- /dev/null +++ b/assets/formula/28-dark.svg @@ -0,0 +1,55 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/28-light.svg b/assets/formula/28-light.svg new file mode 100644 index 0000000..1034a63 --- /dev/null +++ b/assets/formula/28-light.svg @@ -0,0 +1,55 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/29-dark.svg b/assets/formula/29-dark.svg new file mode 100644 index 0000000..63cc420 --- /dev/null +++ b/assets/formula/29-dark.svg @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/29-light.svg b/assets/formula/29-light.svg new file mode 100644 index 0000000..63cc420 --- /dev/null +++ b/assets/formula/29-light.svg @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/30-dark.svg b/assets/formula/30-dark.svg new file mode 100644 index 0000000..ff2ab6e --- /dev/null +++ b/assets/formula/30-dark.svg @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/30-light.svg b/assets/formula/30-light.svg new file mode 100644 index 0000000..ff2ab6e --- /dev/null +++ b/assets/formula/30-light.svg @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/31-dark.svg b/assets/formula/31-dark.svg new file mode 100644 index 0000000..4bc4f75 --- /dev/null +++ b/assets/formula/31-dark.svg @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/31-light.svg b/assets/formula/31-light.svg new file mode 100644 index 0000000..4bc4f75 --- /dev/null +++ b/assets/formula/31-light.svg @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/32-dark.svg b/assets/formula/32-dark.svg new file mode 100644 index 0000000..0aca717 --- /dev/null +++ b/assets/formula/32-dark.svg @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/32-light.svg b/assets/formula/32-light.svg new file mode 100644 index 0000000..0aca717 --- /dev/null +++ b/assets/formula/32-light.svg @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/33-dark.svg b/assets/formula/33-dark.svg new file mode 100644 index 0000000..54c44e4 --- /dev/null +++ b/assets/formula/33-dark.svg @@ -0,0 +1,75 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/33-light.svg b/assets/formula/33-light.svg new file mode 100644 index 0000000..8c9362b --- /dev/null +++ b/assets/formula/33-light.svg @@ -0,0 +1,75 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/34-dark.svg b/assets/formula/34-dark.svg new file mode 100644 index 0000000..9a3f379 --- /dev/null +++ b/assets/formula/34-dark.svg @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/34-light.svg b/assets/formula/34-light.svg new file mode 100644 index 0000000..5e63480 --- /dev/null +++ b/assets/formula/34-light.svg @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/35-dark.svg b/assets/formula/35-dark.svg new file mode 100644 index 0000000..f2647dc --- /dev/null +++ b/assets/formula/35-dark.svg @@ -0,0 +1,97 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/35-light.svg b/assets/formula/35-light.svg new file mode 100644 index 0000000..38ea203 --- /dev/null +++ b/assets/formula/35-light.svg @@ -0,0 +1,97 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/36-dark.svg b/assets/formula/36-dark.svg new file mode 100644 index 0000000..cbdf48f --- /dev/null +++ b/assets/formula/36-dark.svg @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/36-light.svg b/assets/formula/36-light.svg new file mode 100644 index 0000000..7370156 --- /dev/null +++ b/assets/formula/36-light.svg @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/37-dark.svg b/assets/formula/37-dark.svg new file mode 100644 index 0000000..f5c13f5 --- /dev/null +++ b/assets/formula/37-dark.svg @@ -0,0 +1,113 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/37-light.svg b/assets/formula/37-light.svg new file mode 100644 index 0000000..9c23f96 --- /dev/null +++ b/assets/formula/37-light.svg @@ -0,0 +1,113 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/38-dark.svg b/assets/formula/38-dark.svg new file mode 100644 index 0000000..d8a4440 --- /dev/null +++ b/assets/formula/38-dark.svg @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/38-light.svg b/assets/formula/38-light.svg new file mode 100644 index 0000000..418b58c --- /dev/null +++ b/assets/formula/38-light.svg @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/39-dark.svg b/assets/formula/39-dark.svg new file mode 100644 index 0000000..ab5aa6e --- /dev/null +++ b/assets/formula/39-dark.svg @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/39-light.svg b/assets/formula/39-light.svg new file mode 100644 index 0000000..ed4faa9 --- /dev/null +++ b/assets/formula/39-light.svg @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/4-dark.svg b/assets/formula/4-dark.svg new file mode 100644 index 0000000..3602b34 --- /dev/null +++ b/assets/formula/4-dark.svg @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/4-light.svg b/assets/formula/4-light.svg new file mode 100644 index 0000000..555772f --- /dev/null +++ b/assets/formula/4-light.svg @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/40-dark.svg b/assets/formula/40-dark.svg new file mode 100644 index 0000000..3c6530d --- /dev/null +++ b/assets/formula/40-dark.svg @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/40-light.svg b/assets/formula/40-light.svg new file mode 100644 index 0000000..7362e60 --- /dev/null +++ b/assets/formula/40-light.svg @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/41-dark.svg b/assets/formula/41-dark.svg new file mode 100644 index 0000000..36aaa40 --- /dev/null +++ b/assets/formula/41-dark.svg @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/41-light.svg b/assets/formula/41-light.svg new file mode 100644 index 0000000..718377c --- /dev/null +++ b/assets/formula/41-light.svg @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/42-dark.svg b/assets/formula/42-dark.svg new file mode 100644 index 0000000..44b1fff --- /dev/null +++ b/assets/formula/42-dark.svg @@ -0,0 +1,95 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/42-light.svg b/assets/formula/42-light.svg new file mode 100644 index 0000000..0a71969 --- /dev/null +++ b/assets/formula/42-light.svg @@ -0,0 +1,95 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/43-dark.svg b/assets/formula/43-dark.svg new file mode 100644 index 0000000..49f3925 --- /dev/null +++ b/assets/formula/43-dark.svg @@ -0,0 +1,213 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/43-light.svg b/assets/formula/43-light.svg new file mode 100644 index 0000000..4c5b008 --- /dev/null +++ b/assets/formula/43-light.svg @@ -0,0 +1,213 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/44-dark.svg b/assets/formula/44-dark.svg new file mode 100644 index 0000000..7fe6fdf --- /dev/null +++ b/assets/formula/44-dark.svg @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/44-light.svg b/assets/formula/44-light.svg new file mode 100644 index 0000000..f24087a --- /dev/null +++ b/assets/formula/44-light.svg @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/45-dark.svg b/assets/formula/45-dark.svg new file mode 100644 index 0000000..d66a3b0 --- /dev/null +++ b/assets/formula/45-dark.svg @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/45-light.svg b/assets/formula/45-light.svg new file mode 100644 index 0000000..df57725 --- /dev/null +++ b/assets/formula/45-light.svg @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/46-dark.svg b/assets/formula/46-dark.svg new file mode 100644 index 0000000..5514112 --- /dev/null +++ b/assets/formula/46-dark.svg @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/46-light.svg b/assets/formula/46-light.svg new file mode 100644 index 0000000..28fe2e4 --- /dev/null +++ b/assets/formula/46-light.svg @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/47-dark.svg b/assets/formula/47-dark.svg new file mode 100644 index 0000000..ff5c541 --- /dev/null +++ b/assets/formula/47-dark.svg @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/47-light.svg b/assets/formula/47-light.svg new file mode 100644 index 0000000..c7e4cc9 --- /dev/null +++ b/assets/formula/47-light.svg @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/48-dark.svg b/assets/formula/48-dark.svg new file mode 100644 index 0000000..aca5ae2 --- /dev/null +++ b/assets/formula/48-dark.svg @@ -0,0 +1,63 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/48-light.svg b/assets/formula/48-light.svg new file mode 100644 index 0000000..88fda6e --- /dev/null +++ b/assets/formula/48-light.svg @@ -0,0 +1,63 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/49-dark.svg b/assets/formula/49-dark.svg new file mode 100644 index 0000000..6f98558 --- /dev/null +++ b/assets/formula/49-dark.svg @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/49-light.svg b/assets/formula/49-light.svg new file mode 100644 index 0000000..e01c44a --- /dev/null +++ b/assets/formula/49-light.svg @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/5-dark.svg b/assets/formula/5-dark.svg new file mode 100644 index 0000000..5ae9d95 --- /dev/null +++ b/assets/formula/5-dark.svg @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/5-light.svg b/assets/formula/5-light.svg new file mode 100644 index 0000000..6f7eac0 --- /dev/null +++ b/assets/formula/5-light.svg @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/50-dark.svg b/assets/formula/50-dark.svg new file mode 100644 index 0000000..6654ada --- /dev/null +++ b/assets/formula/50-dark.svg @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/50-light.svg b/assets/formula/50-light.svg new file mode 100644 index 0000000..330abc5 --- /dev/null +++ b/assets/formula/50-light.svg @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/51-dark.svg b/assets/formula/51-dark.svg new file mode 100644 index 0000000..e29f850 --- /dev/null +++ b/assets/formula/51-dark.svg @@ -0,0 +1,91 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/51-light.svg b/assets/formula/51-light.svg new file mode 100644 index 0000000..4f30131 --- /dev/null +++ b/assets/formula/51-light.svg @@ -0,0 +1,91 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/52-dark.svg b/assets/formula/52-dark.svg new file mode 100644 index 0000000..2220603 --- /dev/null +++ b/assets/formula/52-dark.svg @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/52-light.svg b/assets/formula/52-light.svg new file mode 100644 index 0000000..42ed6b1 --- /dev/null +++ b/assets/formula/52-light.svg @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/53-dark.svg b/assets/formula/53-dark.svg new file mode 100644 index 0000000..f42e3c1 --- /dev/null +++ b/assets/formula/53-dark.svg @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/53-light.svg b/assets/formula/53-light.svg new file mode 100644 index 0000000..8690b43 --- /dev/null +++ b/assets/formula/53-light.svg @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/54-dark.svg b/assets/formula/54-dark.svg new file mode 100644 index 0000000..8acb9e9 --- /dev/null +++ b/assets/formula/54-dark.svg @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/54-light.svg b/assets/formula/54-light.svg new file mode 100644 index 0000000..a14a50e --- /dev/null +++ b/assets/formula/54-light.svg @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/55-dark.svg b/assets/formula/55-dark.svg new file mode 100644 index 0000000..c71972f --- /dev/null +++ b/assets/formula/55-dark.svg @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/55-light.svg b/assets/formula/55-light.svg new file mode 100644 index 0000000..9a4cac6 --- /dev/null +++ b/assets/formula/55-light.svg @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/56-dark.svg b/assets/formula/56-dark.svg new file mode 100644 index 0000000..88bd5ed --- /dev/null +++ b/assets/formula/56-dark.svg @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/56-light.svg b/assets/formula/56-light.svg new file mode 100644 index 0000000..ff615dc --- /dev/null +++ b/assets/formula/56-light.svg @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/57-dark.svg b/assets/formula/57-dark.svg new file mode 100644 index 0000000..b2ce2a1 --- /dev/null +++ b/assets/formula/57-dark.svg @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/57-light.svg b/assets/formula/57-light.svg new file mode 100644 index 0000000..0da1bb6 --- /dev/null +++ b/assets/formula/57-light.svg @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/58-dark.svg b/assets/formula/58-dark.svg new file mode 100644 index 0000000..581eeff --- /dev/null +++ b/assets/formula/58-dark.svg @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/58-light.svg b/assets/formula/58-light.svg new file mode 100644 index 0000000..431db00 --- /dev/null +++ b/assets/formula/58-light.svg @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/59-dark.svg b/assets/formula/59-dark.svg new file mode 100644 index 0000000..19c3b79 --- /dev/null +++ b/assets/formula/59-dark.svg @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/59-light.svg b/assets/formula/59-light.svg new file mode 100644 index 0000000..f056916 --- /dev/null +++ b/assets/formula/59-light.svg @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/6-dark.svg b/assets/formula/6-dark.svg new file mode 100644 index 0000000..2a40e39 --- /dev/null +++ b/assets/formula/6-dark.svg @@ -0,0 +1,83 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/6-light.svg b/assets/formula/6-light.svg new file mode 100644 index 0000000..daf46fd --- /dev/null +++ b/assets/formula/6-light.svg @@ -0,0 +1,83 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/60-dark.svg b/assets/formula/60-dark.svg new file mode 100644 index 0000000..f948493 --- /dev/null +++ b/assets/formula/60-dark.svg @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/60-light.svg b/assets/formula/60-light.svg new file mode 100644 index 0000000..42a5744 --- /dev/null +++ b/assets/formula/60-light.svg @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/61-dark.svg b/assets/formula/61-dark.svg new file mode 100644 index 0000000..171002e --- /dev/null +++ b/assets/formula/61-dark.svg @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/61-light.svg b/assets/formula/61-light.svg new file mode 100644 index 0000000..394759b --- /dev/null +++ b/assets/formula/61-light.svg @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/62-dark.svg b/assets/formula/62-dark.svg new file mode 100644 index 0000000..91eddc2 --- /dev/null +++ b/assets/formula/62-dark.svg @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/62-light.svg b/assets/formula/62-light.svg new file mode 100644 index 0000000..79487b0 --- /dev/null +++ b/assets/formula/62-light.svg @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/63-dark.svg b/assets/formula/63-dark.svg new file mode 100644 index 0000000..f5c5478 --- /dev/null +++ b/assets/formula/63-dark.svg @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/63-light.svg b/assets/formula/63-light.svg new file mode 100644 index 0000000..695ee14 --- /dev/null +++ b/assets/formula/63-light.svg @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/64-dark.svg b/assets/formula/64-dark.svg new file mode 100644 index 0000000..ddcce5d --- /dev/null +++ b/assets/formula/64-dark.svg @@ -0,0 +1,53 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/64-light.svg b/assets/formula/64-light.svg new file mode 100644 index 0000000..75ca159 --- /dev/null +++ b/assets/formula/64-light.svg @@ -0,0 +1,53 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/65-dark.svg b/assets/formula/65-dark.svg new file mode 100644 index 0000000..289d1cb --- /dev/null +++ b/assets/formula/65-dark.svg @@ -0,0 +1,50 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/65-light.svg b/assets/formula/65-light.svg new file mode 100644 index 0000000..276b99c --- /dev/null +++ b/assets/formula/65-light.svg @@ -0,0 +1,50 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/66-dark.svg b/assets/formula/66-dark.svg new file mode 100644 index 0000000..0f74ab9 --- /dev/null +++ b/assets/formula/66-dark.svg @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/66-light.svg b/assets/formula/66-light.svg new file mode 100644 index 0000000..fda3226 --- /dev/null +++ b/assets/formula/66-light.svg @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/67-dark.svg b/assets/formula/67-dark.svg new file mode 100644 index 0000000..7fd3893 --- /dev/null +++ b/assets/formula/67-dark.svg @@ -0,0 +1,69 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/67-light.svg b/assets/formula/67-light.svg new file mode 100644 index 0000000..80ae428 --- /dev/null +++ b/assets/formula/67-light.svg @@ -0,0 +1,69 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/68-dark.svg b/assets/formula/68-dark.svg new file mode 100644 index 0000000..76b70c3 --- /dev/null +++ b/assets/formula/68-dark.svg @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/68-light.svg b/assets/formula/68-light.svg new file mode 100644 index 0000000..fc7f4e1 --- /dev/null +++ b/assets/formula/68-light.svg @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/7-dark.svg b/assets/formula/7-dark.svg new file mode 100644 index 0000000..3fc1efe --- /dev/null +++ b/assets/formula/7-dark.svg @@ -0,0 +1,76 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/7-light.svg b/assets/formula/7-light.svg new file mode 100644 index 0000000..a328240 --- /dev/null +++ b/assets/formula/7-light.svg @@ -0,0 +1,76 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/8-dark.svg b/assets/formula/8-dark.svg new file mode 100644 index 0000000..ecf8a32 --- /dev/null +++ b/assets/formula/8-dark.svg @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/8-light.svg b/assets/formula/8-light.svg new file mode 100644 index 0000000..7dc040b --- /dev/null +++ b/assets/formula/8-light.svg @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/9-dark.svg b/assets/formula/9-dark.svg new file mode 100644 index 0000000..377d690 --- /dev/null +++ b/assets/formula/9-dark.svg @@ -0,0 +1,213 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/9-light.svg b/assets/formula/9-light.svg new file mode 100644 index 0000000..8f6e38f --- /dev/null +++ b/assets/formula/9-light.svg @@ -0,0 +1,213 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file From b00d4356743431c003a241a1bbfe77d9444296fa Mon Sep 17 00:00:00 2001 From: bitcookies Date: Thu, 10 Feb 2022 11:24:20 +0800 Subject: [PATCH 07/11] =?UTF-8?q?=F0=9F=8C=99=20Adapt=20the=20Github=20Dar?= =?UTF-8?q?k=20Theme?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 🌙 Adapt the Github Dark Theme --- assets/formula/17-dark.svg | 2 +- assets/formula/18-dark.svg | 2 +- assets/formula/19-dark.svg | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/assets/formula/17-dark.svg b/assets/formula/17-dark.svg index 9c77315..629682b 100644 --- a/assets/formula/17-dark.svg +++ b/assets/formula/17-dark.svg @@ -1,6 +1,6 @@ - + diff --git a/assets/formula/18-dark.svg b/assets/formula/18-dark.svg index a89e97b..df6fd98 100644 --- a/assets/formula/18-dark.svg +++ b/assets/formula/18-dark.svg @@ -1,6 +1,6 @@ - + diff --git a/assets/formula/19-dark.svg b/assets/formula/19-dark.svg index 77a7824..483b5cc 100644 --- a/assets/formula/19-dark.svg +++ b/assets/formula/19-dark.svg @@ -1,6 +1,6 @@ - + From bdaca9c47f856a9dffe8a70ecdded651de0ab6ea Mon Sep 17 00:00:00 2001 From: bitcookies Date: Thu, 10 Feb 2022 11:31:45 +0800 Subject: [PATCH 08/11] =?UTF-8?q?=F0=9F=8C=99=20Adapt=20the=20Github=20Dar?= =?UTF-8?q?k=20Theme?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 🌙 Adapt the Github Dark Theme --- README.HOW_DOES_IT_WORK.zh-CN.md | 4 ++-- assets/formula/29-dark.svg | 2 +- assets/formula/30-dark.svg | 2 +- assets/formula/31-dark.svg | 2 +- assets/formula/32-dark.svg | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.HOW_DOES_IT_WORK.zh-CN.md b/README.HOW_DOES_IT_WORK.zh-CN.md index c47bb32..e7b8e2f 100644 --- a/README.HOW_DOES_IT_WORK.zh-CN.md +++ b/README.HOW_DOES_IT_WORK.zh-CN.md @@ -264,7 +264,7 @@ WinRAR的私钥 ![k-inlined] 为: 3. 使用 ![Data3-inlined] 通过算法5计算出私钥 ![kdata3](assets/formula/49-light.svg#gh-light-mode-only)![kdata3](assets/formula/49-dark.svg#gh-dark-mode-only) 以及公钥 ![pdata3](assets/formula/50-light.svg#gh-light-mode-only)![pdata3](assets/formula/50-dark.svg#gh-dark-mode-only),并将公钥 ![pdata3](assets/formula/50-light.svg#gh-light-mode-only)![pdata3](assets/formula/50-dark.svg#gh-dark-mode-only) 按照 SM2 压缩公钥格式以 Hex 字符串(ASCII编码)的形式输出。得到的Hex字符串记为 ![Data0-inlined]。 - ![Data0-inlined] 的长度应该为64;若长度不足,则在前面补字符`'0'`,直到长度为64。 + ![Data0-inlined] 的长度应该为64;若长度不足,则在前面补字符 `'0'`,直到长度为64。 4. 令字符串 ![UID-inlined]为 @@ -302,7 +302,7 @@ WinRAR的私钥 ![k-inlined] 为: 9. 将 ![rTemp](assets/formula/60-light.svg#gh-light-mode-only)![rTemp](assets/formula/60-dark.svg#gh-dark-mode-only) 和 ![sTemp](assets/formula/61-light.svg#gh-light-mode-only)![sTemp](assets/formula/61-dark.svg#gh-dark-mode-only) 以16进制形式输出(无`"0x"`前缀),分别记为 ![SZrTemp](assets/formula/62-light.svg#gh-light-mode-only)![SZrTemp](assets/formula/62-dark.svg#gh-dark-mode-only) 和 ![SZsTemp](assets/formula/63-light.svg#gh-light-mode-only)![SZsTemp](assets/formula/63-dark.svg#gh-dark-mode-only)。 - 若长度不满60,则在前面补字符`'0'`,直到长度为60。 + 若长度不满60,则在前面补字符 `'0'`,直到长度为60。 10. 令字符串 ![Data2-inlined]为 diff --git a/assets/formula/29-dark.svg b/assets/formula/29-dark.svg index 63cc420..32c2194 100644 --- a/assets/formula/29-dark.svg +++ b/assets/formula/29-dark.svg @@ -1,6 +1,6 @@ - + diff --git a/assets/formula/30-dark.svg b/assets/formula/30-dark.svg index ff2ab6e..3b6508c 100644 --- a/assets/formula/30-dark.svg +++ b/assets/formula/30-dark.svg @@ -1,6 +1,6 @@ - + diff --git a/assets/formula/31-dark.svg b/assets/formula/31-dark.svg index 4bc4f75..db6e0a7 100644 --- a/assets/formula/31-dark.svg +++ b/assets/formula/31-dark.svg @@ -1,6 +1,6 @@ - + diff --git a/assets/formula/32-dark.svg b/assets/formula/32-dark.svg index 0aca717..9521636 100644 --- a/assets/formula/32-dark.svg +++ b/assets/formula/32-dark.svg @@ -1,6 +1,6 @@ - + From dd88649d292074a146f016144e91b378cb5f410e Mon Sep 17 00:00:00 2001 From: bitcookies Date: Thu, 10 Feb 2022 13:23:05 +0800 Subject: [PATCH 09/11] =?UTF-8?q?=F0=9F=8C=99=20Adapt=20the=20Github=20Dar?= =?UTF-8?q?k=20Theme?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 🌙 Adapt the Github Dark Theme --- README.HOW_DOES_IT_WORK.zh-CN.md | 69 +++++++++++++------------- assets/formula/AA-inlined-dark.svg | 10 ++++ assets/formula/AA-inlined-light.svg | 10 ++++ assets/formula/BB-inlined-dark.svg | 10 ++++ assets/formula/BB-inlined-light.svg | 10 ++++ assets/formula/DD-inlined-dark.svg | 10 ++++ assets/formula/DD-inlined-light.svg | 10 ++++ assets/formula/Data-inlined-dark.svg | 15 ++++++ assets/formula/Data-inlined-light.svg | 15 ++++++ assets/formula/Data0-inlined-dark.svg | 17 +++++++ assets/formula/Data0-inlined-light.svg | 17 +++++++ assets/formula/Data1-inlined-dark.svg | 17 +++++++ assets/formula/Data1-inlined-light.svg | 17 +++++++ assets/formula/Data2-inlined-dark.svg | 17 +++++++ assets/formula/Data2-inlined-light.svg | 17 +++++++ assets/formula/Data3-inlined-dark.svg | 17 +++++++ assets/formula/Data3-inlined-light.svg | 17 +++++++ assets/formula/GG-inlined-dark.svg | 10 ++++ assets/formula/GG-inlined-light.svg | 10 ++++ assets/formula/LL-inlined-dark.svg | 10 ++++ assets/formula/LL-inlined-light.svg | 10 ++++ assets/formula/MM-inlined-dark.svg | 10 ++++ assets/formula/MM-inlined-light.svg | 10 ++++ assets/formula/PP-inlined-dark.svg | 10 ++++ assets/formula/PP-inlined-light.svg | 10 ++++ assets/formula/Rnd-inlined-dark.svg | 14 ++++++ assets/formula/Rnd-inlined-light.svg | 14 ++++++ assets/formula/TT-inlined-dark.svg | 10 ++++ assets/formula/TT-inlined-light.svg | 10 ++++ assets/formula/Temp-inlined-dark.svg | 16 ++++++ assets/formula/Temp-inlined-light.svg | 16 ++++++ assets/formula/UID-inlined-dark.svg | 14 ++++++ assets/formula/UID-inlined-light.svg | 14 ++++++ assets/formula/UU-inlined-dark.svg | 10 ++++ assets/formula/UU-inlined-light.svg | 10 ++++ assets/formula/h-inlined-dark.svg | 10 ++++ assets/formula/h-inlined-light.svg | 10 ++++ assets/formula/k-inlined-dark.svg | 10 ++++ assets/formula/k-inlined-light.svg | 10 ++++ assets/formula/l-inlined-dark.svg | 10 ++++ assets/formula/l-inlined-light.svg | 10 ++++ assets/formula/n-inlined-dark.svg | 10 ++++ assets/formula/n-inlined-light.svg | 10 ++++ assets/formula/r-inlined-dark.svg | 10 ++++ assets/formula/r-inlined-light.svg | 10 ++++ assets/formula/s-inlined-dark.svg | 10 ++++ assets/formula/s-inlined-light.svg | 10 ++++ 47 files changed, 588 insertions(+), 35 deletions(-) create mode 100644 assets/formula/AA-inlined-dark.svg create mode 100644 assets/formula/AA-inlined-light.svg create mode 100644 assets/formula/BB-inlined-dark.svg create mode 100644 assets/formula/BB-inlined-light.svg create mode 100644 assets/formula/DD-inlined-dark.svg create mode 100644 assets/formula/DD-inlined-light.svg create mode 100644 assets/formula/Data-inlined-dark.svg create mode 100644 assets/formula/Data-inlined-light.svg create mode 100644 assets/formula/Data0-inlined-dark.svg create mode 100644 assets/formula/Data0-inlined-light.svg create mode 100644 assets/formula/Data1-inlined-dark.svg create mode 100644 assets/formula/Data1-inlined-light.svg create mode 100644 assets/formula/Data2-inlined-dark.svg create mode 100644 assets/formula/Data2-inlined-light.svg create mode 100644 assets/formula/Data3-inlined-dark.svg create mode 100644 assets/formula/Data3-inlined-light.svg create mode 100644 assets/formula/GG-inlined-dark.svg create mode 100644 assets/formula/GG-inlined-light.svg create mode 100644 assets/formula/LL-inlined-dark.svg create mode 100644 assets/formula/LL-inlined-light.svg create mode 100644 assets/formula/MM-inlined-dark.svg create mode 100644 assets/formula/MM-inlined-light.svg create mode 100644 assets/formula/PP-inlined-dark.svg create mode 100644 assets/formula/PP-inlined-light.svg create mode 100644 assets/formula/Rnd-inlined-dark.svg create mode 100644 assets/formula/Rnd-inlined-light.svg create mode 100644 assets/formula/TT-inlined-dark.svg create mode 100644 assets/formula/TT-inlined-light.svg create mode 100644 assets/formula/Temp-inlined-dark.svg create mode 100644 assets/formula/Temp-inlined-light.svg create mode 100644 assets/formula/UID-inlined-dark.svg create mode 100644 assets/formula/UID-inlined-light.svg create mode 100644 assets/formula/UU-inlined-dark.svg create mode 100644 assets/formula/UU-inlined-light.svg create mode 100644 assets/formula/h-inlined-dark.svg create mode 100644 assets/formula/h-inlined-light.svg create mode 100644 assets/formula/k-inlined-dark.svg create mode 100644 assets/formula/k-inlined-light.svg create mode 100644 assets/formula/l-inlined-dark.svg create mode 100644 assets/formula/l-inlined-light.svg create mode 100644 assets/formula/n-inlined-dark.svg create mode 100644 assets/formula/n-inlined-light.svg create mode 100644 assets/formula/r-inlined-dark.svg create mode 100644 assets/formula/r-inlined-light.svg create mode 100644 assets/formula/s-inlined-dark.svg create mode 100644 assets/formula/s-inlined-light.svg diff --git a/README.HOW_DOES_IT_WORK.zh-CN.md b/README.HOW_DOES_IT_WORK.zh-CN.md index e7b8e2f..e75eefd 100644 --- a/README.HOW_DOES_IT_WORK.zh-CN.md +++ b/README.HOW_DOES_IT_WORK.zh-CN.md @@ -19,7 +19,7 @@ WinRAR 使用了基于 ECC 的签名算法来生成 `rarreg.key` 文件,其使

-则位于基域 ![GF2p15-inlined](assets/formula/GF2p15-inlined-light.svg#gh-light-mode-only)![GF2p15-inlined](assets/formula/GF2p15-inlined-dark.svg#gh-dark-mode-only) 上的元素 ![A-inlined] 可以用如下方式表达: +则位于基域 ![GF2p15-inlined](assets/formula/GF2p15-inlined-light.svg#gh-light-mode-only)![GF2p15-inlined](assets/formula/GF2p15-inlined-dark.svg#gh-dark-mode-only) 上的元素 ![A](assets/formula/AA-inlined-light.svg#gh-light-mode-only)![A](assets/formula/AA-inlined-dark.svg#gh-dark-mode-only) 可以用如下方式表达:

@@ -45,7 +45,7 @@ WinRAR 使用了基于 ECC 的签名算法来生成 `rarreg.key` 文件,其使

-则位于复合域 ![GF2p15p17-inlined](assets/formula/GF2p15p17-inlined-light.svg#gh-light-mode-only) ![GF2p15p17-inlined](assets/formula/GF2p15p17-inlined-dark.svg#gh-dark-mode-only) 上的元素 ![B-inlined] 可以用如下方式表达: +则位于复合域 ![GF2p15p17-inlined](assets/formula/GF2p15p17-inlined-light.svg#gh-light-mode-only) ![GF2p15p17-inlined](assets/formula/GF2p15p17-inlined-dark.svg#gh-dark-mode-only) 上的元素 ![B](assets/formula/BB-inlined-light.svg#gh-light-mode-only)![B](assets/formula/BB-inlined-dark.svg#gh-dark-mode-only) 可以用如下方式表达:

@@ -55,7 +55,7 @@ WinRAR 使用了基于 ECC 的签名算法来生成 `rarreg.key` 文件,其使 --- -为了方便表述我们用255比特的大数 ![D-inlined] 来表示位于复合域 ![GF2p15p17-inlined](assets/formula/GF2p15p17-inlined-light.svg#gh-light-mode-only) ![GF2p15p17-inlined](assets/formula/GF2p15p17-inlined-dark.svg#gh-dark-mode-only) 上的元素 ![B-inlined]。它们的对应关系为: +为了方便表述我们用255比特的大数 ![D](assets/formula/DD-inlined-light.svg#gh-light-mode-only)![D](assets/formula/DD-inlined-dark.svg#gh-dark-mode-only) 来表示位于复合域 ![GF2p15p17-inlined](assets/formula/GF2p15p17-inlined-light.svg#gh-light-mode-only) ![GF2p15p17-inlined](assets/formula/GF2p15p17-inlined-dark.svg#gh-dark-mode-only) 上的元素 ![B](assets/formula/BB-inlined-light.svg#gh-light-mode-only)![B](assets/formula/BB-inlined-dark.svg#gh-dark-mode-only)。它们的对应关系为:

@@ -73,7 +73,7 @@ WinRAR 使用了基于 ECC 的签名算法来生成 `rarreg.key` 文件,其使

-基点 ![G-inlined] 为: +基点 ![G](assets/formula/GG-inlined-light.svg#gh-light-mode-only)![G](assets/formula/GG-inlined-dark.svg#gh-dark-mode-only) 为:

@@ -81,7 +81,7 @@ WinRAR 使用了基于 ECC 的签名算法来生成 `rarreg.key` 文件,其使

-基点 ![G-inlined] 的阶 ![n-inlined] 为: +基点 ![G](assets/formula/GG-inlined-light.svg#gh-light-mode-only)![G](assets/formula/GG-inlined-dark.svg#gh-dark-mode-only) 的阶 ![n](assets/formula/n-inlined-light.svg#gh-light-mode-only)![n](assets/formula/n-inlined-dark.svg#gh-dark-mode-only) 为:

@@ -91,7 +91,7 @@ WinRAR 使用了基于 ECC 的签名算法来生成 `rarreg.key` 文件,其使 ## 3. 消息哈希算法 -设长度为 ![l-inlined] 的消息为: +设长度为 ![l](assets/formula/l-inlined-light.svg#gh-light-mode-only)![l](assets/formula/l-inlined-dark.svg#gh-dark-mode-only) 的消息为:

@@ -99,7 +99,7 @@ WinRAR 使用了基于 ECC 的签名算法来生成 `rarreg.key` 文件,其使

-则消息 ![M-inlined] 的SHA1值为: +则消息 ![M](assets/formula/MM-inlined-light.svg#gh-light-mode-only)![M](assets/formula/MM-inlined-dark.svg#gh-dark-mode-only) 的 SHA1 值为:

@@ -107,9 +107,9 @@ WinRAR 使用了基于 ECC 的签名算法来生成 `rarreg.key` 文件,其使

-其中 ![s0,4](assets/formula/13-light.svg#gh-light-mode-only)![s0,4](assets/formula/13-dark.svg#gh-dark-mode-only) 为SHA1算法输出时的5个状态值;将这5个状态值按照大端字节序依次输出,即为的SHA1哈希值 ![SHA1M](assets/formula/14-light.svg#gh-light-mode-only)![SHA1M](assets/formula/14-dark.svg#gh-dark-mode-only)。 +其中 ![s0,4](assets/formula/13-light.svg#gh-light-mode-only)![s0,4](assets/formula/13-dark.svg#gh-dark-mode-only) 为 SHA1 算法输出时的5个状态值;将这5个状态值按照大端字节序依次输出,即为的 SHA1 哈希值 ![SHA1M](assets/formula/14-light.svg#gh-light-mode-only)![SHA1M](assets/formula/14-dark.svg#gh-dark-mode-only)。 -WinRAR 在做完 SHA1 计算后,采用大数 ![h-inlined] 作为 ECC 签名时消息的哈希: +WinRAR 在做完 SHA1 计算后,采用大数 ![h](assets/formula/h-inlined-light.svg#gh-light-mode-only)![h](assets/formula/h-inlined-dark.svg#gh-dark-mode-only) 作为 ECC 签名时消息的哈希:

@@ -118,7 +118,7 @@ WinRAR 在做完 SHA1 计算后,采用大数 ![h-inlined] 作为 ECC 签名时 ## 4. ECC签名算法 -设私钥为 ![k-inlined],公钥为 ![P-inlined],即: +设私钥为 ![k](assets/formula/k-inlined-light.svg#gh-light-mode-only)![k](assets/formula/k-inlined-dark.svg#gh-dark-mode-only),公钥为 ![P](assets/formula/PP-inlined-light.svg#gh-light-mode-only)![P](assets/formula/PP-inlined-dark.svg#gh-dark-mode-only),即:

@@ -126,11 +126,11 @@ WinRAR 在做完 SHA1 计算后,采用大数 ![h-inlined] 作为 ECC 签名时

-消息哈希为 ![h-inlined],则签名 ![(r,s)](assets/formula/17-light.svg#gh-light-mode-only)![(r,s)](assets/formula/17-dark.svg#gh-dark-mode-only) 为: +消息哈希为 ![h](assets/formula/h-inlined-light.svg#gh-light-mode-only)![h](assets/formula/h-inlined-dark.svg#gh-dark-mode-only),则签名 ![(r,s)](assets/formula/17-light.svg#gh-light-mode-only)![(r,s)](assets/formula/17-dark.svg#gh-dark-mode-only) 为: -1. 生成随机数 ![Rnd-inlined],满足 ![RND](assets/formula/18-light.svg#gh-light-mode-only)![RND](assets/formula/18-dark.svg#gh-dark-mode-only)。 +1. 生成随机数 ![Rnd](assets/formula/Rnd-inlined-light.svg#gh-light-mode-only)![Rnd](assets/formula/Rnd-inlined-dark.svg#gh-dark-mode-only),满足 ![RND](assets/formula/18-light.svg#gh-light-mode-only)![RND](assets/formula/18-dark.svg#gh-dark-mode-only)。 -2. 计算 ![r-inlined] +2. 计算 ![r](assets/formula/r-inlined-light.svg#gh-light-mode-only)![r](assets/formula/r-inlined-dark.svg#gh-dark-mode-only)

@@ -142,7 +142,7 @@ WinRAR 在做完 SHA1 计算后,采用大数 ![h-inlined] 作为 ECC 签名时 若 ![r=0](assets/formula/22-light.svg#gh-light-mode-only)![r=0](assets/formula/22-dark.svg#gh-dark-mode-only) 或者 ![rRnd](assets/formula/23-light.svg#gh-light-mode-only)![rRnd](assets/formula/23-dark.svg#gh-dark-mode-only) 则回到步骤1。 -3. 计算 ![s-inlined] +3. 计算 ![s](assets/formula/s-inlined-light.svg#gh-light-mode-only)![s](assets/formula/s-inlined-dark.svg#gh-dark-mode-only)

@@ -156,7 +156,7 @@ WinRAR 在做完 SHA1 计算后,采用大数 ![h-inlined] 作为 ECC 签名时 ## 5. WinRAR的私钥生成算法 -该算法会利用长度为 ![l-inlined] 的数据 +该算法会利用长度为 ![l](assets/formula/l-inlined-light.svg#gh-light-mode-only)![l](assets/formula/l-inlined-dark.svg#gh-dark-mode-only) 的数据

@@ -164,7 +164,7 @@ WinRAR 在做完 SHA1 计算后,采用大数 ![h-inlined] 作为 ECC 签名时

-来生成私钥 ![k-inlined]。 +来生成私钥 ![k](assets/formula/k-inlined-light.svg#gh-light-mode-only)![k](assets/formula/k-inlined-dark.svg#gh-dark-mode-only)。 1. 设6个32位整数为 ![g0-5](assets/formula/27-light.svg#gh-light-mode-only)![g0-5](assets/formula/27-dark.svg#gh-dark-mode-only),则有 @@ -175,7 +175,7 @@ WinRAR 在做完 SHA1 计算后,采用大数 ![h-inlined] 作为 ECC 签名时 2. 令 ![g0=0](assets/formula/29-light.svg#gh-light-mode-only)![g0=0](assets/formula/29-dark.svg#gh-dark-mode-only)。 -3. 如果 ![l!=0](assets/formula/30-light.svg#gh-light-mode-only)![l!=0](assets/formula/30-dark.svg#gh-dark-mode-only) 则计算 ![T-inlined] 的 SHA1 值,并将状态值 ![Si](assets/formula/31-light.svg#gh-light-mode-only)![Si](assets/formula/31-dark.svg#gh-dark-mode-only) 赋值给 ![gi+1](assets/formula/32-light.svg#gh-light-mode-only)![gi+1](assets/formula/32-dark.svg#gh-dark-mode-only): +3. 如果 ![l!=0](assets/formula/30-light.svg#gh-light-mode-only)![l!=0](assets/formula/30-dark.svg#gh-dark-mode-only) 则计算 ![TT](assets/formula/TT-inlined-light.svg#gh-light-mode-only)![T](assets/formula/TT-inlined-dark.svg#gh-dark-mode-only) 的 SHA1 值,并将状态值 ![Si](assets/formula/31-light.svg#gh-light-mode-only)![Si](assets/formula/31-dark.svg#gh-dark-mode-only) 赋值给 ![gi+1](assets/formula/32-light.svg#gh-light-mode-only)![gi+1](assets/formula/32-dark.svg#gh-dark-mode-only):

@@ -213,7 +213,7 @@ WinRAR 在做完 SHA1 计算后,采用大数 ![h-inlined] 作为 ECC 签名时 ## 6. WinRAR的公钥和私钥 -WinRAR的私钥 ![k-inlined] 为: +WinRAR 的私钥 ![k](assets/formula/k-inlined-light.svg#gh-light-mode-only)![k](assets/formula/k-inlined-dark.svg#gh-dark-mode-only) 为:

@@ -221,9 +221,9 @@ WinRAR的私钥 ![k-inlined] 为:

-该私钥是通过算法5生成的,其中数据 ![T-inlined] 的长度为0。 +该私钥是通过算法5生成的,其中数据 ![T](assets/formula/TT-inlined-light.svg#gh-light-mode-only)![T](assets/formula/TT-inlined-dark.svg#gh-dark-mode-only) 的长度为0。 -公钥 ![P-inlined] 为: +公钥 ![P](assets/formula/PP-inlined-light.svg#gh-light-mode-only)![P](assets/formula/PP-inlined-dark.svg#gh-dark-mode-only) 为:

@@ -251,29 +251,29 @@ WinRAR的私钥 ![k-inlined] 为: `rarreg.key` 的生成算法如下: -1. 使用用户名 ![UU-inlined] 通过算法5计算出私钥 ![ku](assets/formula/46-light.svg#gh-light-mode-only)![ku](assets/formula/46-dark.svg#gh-dark-mode-only) 以及公钥 ![pu](assets/formula/47-light.svg#gh-light-mode-only)![pu](assets/formula/47-dark.svg#gh-dark-mode-only),并将公钥 ![pu](assets/formula/47-light.svg#gh-light-mode-only)![pu](assets/formula/47-dark.svg#gh-dark-mode-only) 按照 SM2 压缩公钥格式以Hex字符串(ASCII编码)的形式输出。得到的 Hex 字符串记为临时值 ![Temp-inlined]。 +1. 使用用户名 ![U](assets/formula/UU-inlined-light.svg#gh-light-mode-only)![U](assets/formula/UU-inlined-dark.svg#gh-dark-mode-only) 通过算法5计算出私钥 ![ku](assets/formula/46-light.svg#gh-light-mode-only)![ku](assets/formula/46-dark.svg#gh-dark-mode-only) 以及公钥 ![pu](assets/formula/47-light.svg#gh-light-mode-only)![pu](assets/formula/47-dark.svg#gh-dark-mode-only),并将公钥 ![pu](assets/formula/47-light.svg#gh-light-mode-only)![pu](assets/formula/47-dark.svg#gh-dark-mode-only) 按照 SM2 压缩公钥格式以 Hex 字符串(ASCII编码)的形式输出。得到的 Hex 字符串记为临时值 ![Temp](assets/formula/Temp-inlined-light.svg#gh-light-mode-only)![Temp](assets/formula/Temp-inlined-dark.svg#gh-dark-mode-only)。 - ![Temp-inlined] 的长度应该为64;若长度不足,则在前面补字符 `'0'`,直到长度为64。 + ![Temp](assets/formula/Temp-inlined-light.svg#gh-light-mode-only)![Temp](assets/formula/Temp-inlined-dark.svg#gh-dark-mode-only) 的长度应该为64;若长度不足,则在前面补字符 `'0'`,直到长度为64。 -2. 令字符串 ![Data3-inlined]为 +2. 令字符串 ![Data3](assets/formula/Data3-inlined-light.svg#gh-light-mode-only)![Data3](assets/formula/Data3-inlined-dark.svg#gh-dark-mode-only) 为

-3. 使用 ![Data3-inlined] 通过算法5计算出私钥 ![kdata3](assets/formula/49-light.svg#gh-light-mode-only)![kdata3](assets/formula/49-dark.svg#gh-dark-mode-only) 以及公钥 ![pdata3](assets/formula/50-light.svg#gh-light-mode-only)![pdata3](assets/formula/50-dark.svg#gh-dark-mode-only),并将公钥 ![pdata3](assets/formula/50-light.svg#gh-light-mode-only)![pdata3](assets/formula/50-dark.svg#gh-dark-mode-only) 按照 SM2 压缩公钥格式以 Hex 字符串(ASCII编码)的形式输出。得到的Hex字符串记为 ![Data0-inlined]。 +3. 使用 ![Data3](assets/formula/Data3-inlined-light.svg#gh-light-mode-only)![Data3](assets/formula/Data3-inlined-dark.svg#gh-dark-mode-only) 通过算法5计算出私钥 ![kdata3](assets/formula/49-light.svg#gh-light-mode-only)![kdata3](assets/formula/49-dark.svg#gh-dark-mode-only) 以及公钥 ![pdata3](assets/formula/50-light.svg#gh-light-mode-only)![pdata3](assets/formula/50-dark.svg#gh-dark-mode-only),并将公钥 ![pdata3](assets/formula/50-light.svg#gh-light-mode-only)![pdata3](assets/formula/50-dark.svg#gh-dark-mode-only) 按照 SM2 压缩公钥格式以 Hex 字符串(ASCII编码)的形式输出。得到的 Hex 字符串记为 ![Data0](assets/formula/Data0-inlined-light.svg#gh-light-mode-only)![Data0](assets/formula/Data0-inlined-dark.svg#gh-dark-mode-only)。 - ![Data0-inlined] 的长度应该为64;若长度不足,则在前面补字符 `'0'`,直到长度为64。 + ![Data0](assets/formula/Data0-inlined-light.svg#gh-light-mode-only)![Data0](assets/formula/Data0-inlined-dark.svg#gh-dark-mode-only) 的长度应该为64;若长度不足,则在前面补字符 `'0'`,直到长度为64。 -4. 令字符串 ![UID-inlined]为 +4. 令字符串 ![UID](assets/formula/UID-inlined-light.svg#gh-light-mode-only)![UID](assets/formula/UID-inlined-dark.svg#gh-dark-mode-only) 为

-5. 对授权类型 ![LL-inlined] 使用算法4得到签名 ![(rl,sl)](assets/formula/52-light.svg#gh-light-mode-only)![(rl,sl)](assets/formula/52-dark.svg#gh-dark-mode-only),其中私钥见第6节。 +5. 对授权类型 ![L](assets/formula/LL-inlined-light.svg#gh-light-mode-only)![L](assets/formulaLL-inlined-dark.svg#gh-dark-mode-only) 使用算法4得到签名 ![(rl,sl)](assets/formula/52-light.svg#gh-light-mode-only)![(rl,sl)](assets/formula/52-dark.svg#gh-dark-mode-only),其中私钥见第6节。 要求 ![rl](assets/formula/53-light.svg#gh-light-mode-only)![rl](assets/formula/53-dark.svg#gh-dark-mode-only) 和 ![sl](assets/formula/54-light.svg#gh-light-mode-only)![sl](assets/formula/54-dark.svg#gh-dark-mode-only) 的长度都不得超过240比特,否则重复该步骤。 @@ -281,14 +281,14 @@ WinRAR的私钥 ![k-inlined] 为: 若长度不满60,则在前面补字符 `'0'`,直到长度为60。 -7. 令字符串 ![Data1-inlined]为 +7. 令字符串 ![Data1](assets/formula/Data1-inlined-light.svg#gh-light-mode-only)![Data1](assets/formula/Data1-inlined-dark.svg#gh-dark-mode-only) 为

-8. 令字符串 ![Temp-inlined]为 +8. 令字符串 ![Temp](assets/formula/Temp-inlined-light.svg#gh-light-mode-only)![Temp](assets/formula/Temp-inlined-dark.svg#gh-dark-mode-only) 为

@@ -296,7 +296,7 @@ WinRAR的私钥 ![k-inlined] 为:

- 对 ![Temp-inlined] 使用算法4得到签名 ![(rTemp,sTemp)](assets/formula/59-light.svg#gh-light-mode-only)![(rTemp,sTemp)](assets/formula/59-dark.svg#gh-dark-mode-only),其中私钥见第6节。 + 对 ![Temp](assets/formula/Temp-inlined-light.svg#gh-light-mode-only)![Temp](assets/formula/Temp-inlined-dark.svg#gh-dark-mode-only) 使用算法4得到签名 ![(rTemp,sTemp)](assets/formula/59-light.svg#gh-light-mode-only)![(rTemp,sTemp)](assets/formula/59-dark.svg#gh-dark-mode-only),其中私钥见第6节。 要求 ![rTemp](assets/formula/60-light.svg#gh-light-mode-only)![rTemp](assets/formula/60-dark.svg#gh-dark-mode-only) 和 ![sTemp](assets/formula/61-light.svg#gh-light-mode-only)![sTemp](assets/formula/61-dark.svg#gh-dark-mode-only) 的长度都不得超过240比特,否则重复该步骤。 @@ -304,7 +304,7 @@ WinRAR的私钥 ![k-inlined] 为: 若长度不满60,则在前面补字符 `'0'`,直到长度为60。 -10. 令字符串 ![Data2-inlined]为 +10. 令字符串 ![Data2](assets/formula/Data2-inlined-light.svg#gh-light-mode-only)![Data2](assets/formula/Data2-inlined-dark.svg#gh-dark-mode-only) 为

@@ -318,10 +318,9 @@ WinRAR的私钥 ![k-inlined] 为:

+计算 CRC32 值,最终校验和为 CRC32 值的反。将校验和以10进制形式输出,若长度不满10,则在前面补字符 `'0'`,直到长度为10,记为 ![SZchecksum](assets/formula/66-light.svg#gh-light-mode-only)![SZchecksum](assets/formula/66-dark.svg#gh-dark-mode-only)。 - 计算 CRC32 值,最终校验和为 CRC32 值的反。将校验和以10进制形式输出,若长度不满10,则在前面补字符 `'0'`,直到长度为10,记为 ![SZchecksum](assets/formula/66-light.svg#gh-light-mode-only)![SZchecksum](assets/formula/66-dark.svg#gh-dark-mode-only)。 - -12. 令字符串 ![Data-inlined]为 +12. 令字符串 ![Data](assets/formula/Data-inlined-light.svg#gh-light-mode-only)![Data](assets/formula/Data-inlined-dark.svg#gh-dark-mode-only) 为

@@ -343,4 +342,4 @@ WinRAR的私钥 ![k-inlined] 为:

- * 将 ![Data-inlined] 按照每行54个字符输出。 + * 将 ![Data](assets/formula/Data-inlined-light.svg#gh-light-mode-only)![Data](assets/formula/Data-inlined-dark.svg#gh-dark-mode-only) 按照每行54个字符输出。 diff --git a/assets/formula/AA-inlined-dark.svg b/assets/formula/AA-inlined-dark.svg new file mode 100644 index 0000000..7c5eaa8 --- /dev/null +++ b/assets/formula/AA-inlined-dark.svg @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/AA-inlined-light.svg b/assets/formula/AA-inlined-light.svg new file mode 100644 index 0000000..106aa50 --- /dev/null +++ b/assets/formula/AA-inlined-light.svg @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/BB-inlined-dark.svg b/assets/formula/BB-inlined-dark.svg new file mode 100644 index 0000000..687f303 --- /dev/null +++ b/assets/formula/BB-inlined-dark.svg @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/BB-inlined-light.svg b/assets/formula/BB-inlined-light.svg new file mode 100644 index 0000000..d07d0b6 --- /dev/null +++ b/assets/formula/BB-inlined-light.svg @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/DD-inlined-dark.svg b/assets/formula/DD-inlined-dark.svg new file mode 100644 index 0000000..2c5e54e --- /dev/null +++ b/assets/formula/DD-inlined-dark.svg @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/DD-inlined-light.svg b/assets/formula/DD-inlined-light.svg new file mode 100644 index 0000000..5560f7b --- /dev/null +++ b/assets/formula/DD-inlined-light.svg @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/Data-inlined-dark.svg b/assets/formula/Data-inlined-dark.svg new file mode 100644 index 0000000..31f6985 --- /dev/null +++ b/assets/formula/Data-inlined-dark.svg @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/Data-inlined-light.svg b/assets/formula/Data-inlined-light.svg new file mode 100644 index 0000000..3b1dcd9 --- /dev/null +++ b/assets/formula/Data-inlined-light.svg @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/Data0-inlined-dark.svg b/assets/formula/Data0-inlined-dark.svg new file mode 100644 index 0000000..46fc84f --- /dev/null +++ b/assets/formula/Data0-inlined-dark.svg @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/Data0-inlined-light.svg b/assets/formula/Data0-inlined-light.svg new file mode 100644 index 0000000..14391fc --- /dev/null +++ b/assets/formula/Data0-inlined-light.svg @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/Data1-inlined-dark.svg b/assets/formula/Data1-inlined-dark.svg new file mode 100644 index 0000000..1d6f398 --- /dev/null +++ b/assets/formula/Data1-inlined-dark.svg @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/Data1-inlined-light.svg b/assets/formula/Data1-inlined-light.svg new file mode 100644 index 0000000..328c003 --- /dev/null +++ b/assets/formula/Data1-inlined-light.svg @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/Data2-inlined-dark.svg b/assets/formula/Data2-inlined-dark.svg new file mode 100644 index 0000000..731d236 --- /dev/null +++ b/assets/formula/Data2-inlined-dark.svg @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/Data2-inlined-light.svg b/assets/formula/Data2-inlined-light.svg new file mode 100644 index 0000000..ecda7aa --- /dev/null +++ b/assets/formula/Data2-inlined-light.svg @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/Data3-inlined-dark.svg b/assets/formula/Data3-inlined-dark.svg new file mode 100644 index 0000000..8851e82 --- /dev/null +++ b/assets/formula/Data3-inlined-dark.svg @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/Data3-inlined-light.svg b/assets/formula/Data3-inlined-light.svg new file mode 100644 index 0000000..b402f3b --- /dev/null +++ b/assets/formula/Data3-inlined-light.svg @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/GG-inlined-dark.svg b/assets/formula/GG-inlined-dark.svg new file mode 100644 index 0000000..3c08276 --- /dev/null +++ b/assets/formula/GG-inlined-dark.svg @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/GG-inlined-light.svg b/assets/formula/GG-inlined-light.svg new file mode 100644 index 0000000..6572feb --- /dev/null +++ b/assets/formula/GG-inlined-light.svg @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/LL-inlined-dark.svg b/assets/formula/LL-inlined-dark.svg new file mode 100644 index 0000000..b6281bc --- /dev/null +++ b/assets/formula/LL-inlined-dark.svg @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/LL-inlined-light.svg b/assets/formula/LL-inlined-light.svg new file mode 100644 index 0000000..cb52212 --- /dev/null +++ b/assets/formula/LL-inlined-light.svg @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/MM-inlined-dark.svg b/assets/formula/MM-inlined-dark.svg new file mode 100644 index 0000000..b70e225 --- /dev/null +++ b/assets/formula/MM-inlined-dark.svg @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/MM-inlined-light.svg b/assets/formula/MM-inlined-light.svg new file mode 100644 index 0000000..82dbb5f --- /dev/null +++ b/assets/formula/MM-inlined-light.svg @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/PP-inlined-dark.svg b/assets/formula/PP-inlined-dark.svg new file mode 100644 index 0000000..e0d2ca1 --- /dev/null +++ b/assets/formula/PP-inlined-dark.svg @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/PP-inlined-light.svg b/assets/formula/PP-inlined-light.svg new file mode 100644 index 0000000..82cdd7e --- /dev/null +++ b/assets/formula/PP-inlined-light.svg @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/Rnd-inlined-dark.svg b/assets/formula/Rnd-inlined-dark.svg new file mode 100644 index 0000000..894d964 --- /dev/null +++ b/assets/formula/Rnd-inlined-dark.svg @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/Rnd-inlined-light.svg b/assets/formula/Rnd-inlined-light.svg new file mode 100644 index 0000000..78ad79a --- /dev/null +++ b/assets/formula/Rnd-inlined-light.svg @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/TT-inlined-dark.svg b/assets/formula/TT-inlined-dark.svg new file mode 100644 index 0000000..9934a61 --- /dev/null +++ b/assets/formula/TT-inlined-dark.svg @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/TT-inlined-light.svg b/assets/formula/TT-inlined-light.svg new file mode 100644 index 0000000..79bea65 --- /dev/null +++ b/assets/formula/TT-inlined-light.svg @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/Temp-inlined-dark.svg b/assets/formula/Temp-inlined-dark.svg new file mode 100644 index 0000000..a430ae5 --- /dev/null +++ b/assets/formula/Temp-inlined-dark.svg @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/Temp-inlined-light.svg b/assets/formula/Temp-inlined-light.svg new file mode 100644 index 0000000..c8ba688 --- /dev/null +++ b/assets/formula/Temp-inlined-light.svg @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/UID-inlined-dark.svg b/assets/formula/UID-inlined-dark.svg new file mode 100644 index 0000000..12ca3f3 --- /dev/null +++ b/assets/formula/UID-inlined-dark.svg @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/UID-inlined-light.svg b/assets/formula/UID-inlined-light.svg new file mode 100644 index 0000000..29b3523 --- /dev/null +++ b/assets/formula/UID-inlined-light.svg @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/UU-inlined-dark.svg b/assets/formula/UU-inlined-dark.svg new file mode 100644 index 0000000..c271179 --- /dev/null +++ b/assets/formula/UU-inlined-dark.svg @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/UU-inlined-light.svg b/assets/formula/UU-inlined-light.svg new file mode 100644 index 0000000..7d79c29 --- /dev/null +++ b/assets/formula/UU-inlined-light.svg @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/h-inlined-dark.svg b/assets/formula/h-inlined-dark.svg new file mode 100644 index 0000000..8f7d18c --- /dev/null +++ b/assets/formula/h-inlined-dark.svg @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/h-inlined-light.svg b/assets/formula/h-inlined-light.svg new file mode 100644 index 0000000..a49c7a5 --- /dev/null +++ b/assets/formula/h-inlined-light.svg @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/k-inlined-dark.svg b/assets/formula/k-inlined-dark.svg new file mode 100644 index 0000000..547031f --- /dev/null +++ b/assets/formula/k-inlined-dark.svg @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/k-inlined-light.svg b/assets/formula/k-inlined-light.svg new file mode 100644 index 0000000..3f8c34f --- /dev/null +++ b/assets/formula/k-inlined-light.svg @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/l-inlined-dark.svg b/assets/formula/l-inlined-dark.svg new file mode 100644 index 0000000..80bca23 --- /dev/null +++ b/assets/formula/l-inlined-dark.svg @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/l-inlined-light.svg b/assets/formula/l-inlined-light.svg new file mode 100644 index 0000000..be44274 --- /dev/null +++ b/assets/formula/l-inlined-light.svg @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/n-inlined-dark.svg b/assets/formula/n-inlined-dark.svg new file mode 100644 index 0000000..814e6f5 --- /dev/null +++ b/assets/formula/n-inlined-dark.svg @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/n-inlined-light.svg b/assets/formula/n-inlined-light.svg new file mode 100644 index 0000000..028a5a8 --- /dev/null +++ b/assets/formula/n-inlined-light.svg @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/r-inlined-dark.svg b/assets/formula/r-inlined-dark.svg new file mode 100644 index 0000000..ae1a34c --- /dev/null +++ b/assets/formula/r-inlined-dark.svg @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/r-inlined-light.svg b/assets/formula/r-inlined-light.svg new file mode 100644 index 0000000..73004f1 --- /dev/null +++ b/assets/formula/r-inlined-light.svg @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/s-inlined-dark.svg b/assets/formula/s-inlined-dark.svg new file mode 100644 index 0000000..f1fb994 --- /dev/null +++ b/assets/formula/s-inlined-dark.svg @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/assets/formula/s-inlined-light.svg b/assets/formula/s-inlined-light.svg new file mode 100644 index 0000000..aa0ed54 --- /dev/null +++ b/assets/formula/s-inlined-light.svg @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file From 455b3747a33eb59fef7301ca981f9a4bdb5bbcd0 Mon Sep 17 00:00:00 2001 From: bitcookies Date: Thu, 10 Feb 2022 13:27:31 +0800 Subject: [PATCH 10/11] =?UTF-8?q?=F0=9F=8C=99=20Adapt=20the=20Github=20Dar?= =?UTF-8?q?k=20Theme?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 🌙 Adapt the Github Dark Theme --- README.HOW_DOES_IT_WORK.zh-CN.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.HOW_DOES_IT_WORK.zh-CN.md b/README.HOW_DOES_IT_WORK.zh-CN.md index e75eefd..ecbf04b 100644 --- a/README.HOW_DOES_IT_WORK.zh-CN.md +++ b/README.HOW_DOES_IT_WORK.zh-CN.md @@ -63,7 +63,7 @@ WinRAR 使用了基于 ECC 的签名算法来生成 `rarreg.key` 文件,其使

-## 2. 复合域 ![GF2p15p17-inlined] 上的椭圆曲线 +## 2. 复合域 ![GF2p15p17-inlined](assets/formula/GF2p15p17-inlined-light.svg#gh-light-mode-only) ![GF2p15p17-inlined](assets/formula/GF2p15p17-inlined-dark.svg#gh-dark-mode-only) 上的椭圆曲线 曲线方程为: @@ -138,7 +138,7 @@ WinRAR 在做完 SHA1 计算后,采用大数 ![h](assets/formula/h-inlined-lig

- 其中 ![RNDGx](assets/formula/20-light.svg#gh-light-mode-only)![RNDGx](assets/formula/20-dark.svg#gh-dark-mode-only) 表示取 ![RNDG](assets/formula/21-light.svg#gh-light-mode-only)![RNDG](assets/formula/21-dark.svg#gh-dark-mode-only) 的 X 坐标,同时将 X 坐标从 !![GF2p15p17-inlined](assets/formula/GF2p15p17-inlined-light.svg#gh-light-mode-only) ![GF2p15p17-inlined](assets/formula/GF2p15p17-inlined-dark.svg#gh-dark-mode-only) 转换为大数。 + 其中 ![RNDGx](assets/formula/20-light.svg#gh-light-mode-only)![RNDGx](assets/formula/20-dark.svg#gh-dark-mode-only) 表示取 ![RNDG](assets/formula/21-light.svg#gh-light-mode-only)![RNDG](assets/formula/21-dark.svg#gh-dark-mode-only) 的 X 坐标,同时将 X 坐标从 ![GF2p15p17-inlined](assets/formula/GF2p15p17-inlined-light.svg#gh-light-mode-only) ![GF2p15p17-inlined](assets/formula/GF2p15p17-inlined-dark.svg#gh-dark-mode-only) 转换为大数。 若 ![r=0](assets/formula/22-light.svg#gh-light-mode-only)![r=0](assets/formula/22-dark.svg#gh-dark-mode-only) 或者 ![rRnd](assets/formula/23-light.svg#gh-light-mode-only)![rRnd](assets/formula/23-dark.svg#gh-dark-mode-only) 则回到步骤1。 @@ -273,7 +273,7 @@ WinRAR 的私钥 ![k](assets/formula/k-inlined-light.svg#gh-light-mode-only)![k]

-5. 对授权类型 ![L](assets/formula/LL-inlined-light.svg#gh-light-mode-only)![L](assets/formulaLL-inlined-dark.svg#gh-dark-mode-only) 使用算法4得到签名 ![(rl,sl)](assets/formula/52-light.svg#gh-light-mode-only)![(rl,sl)](assets/formula/52-dark.svg#gh-dark-mode-only),其中私钥见第6节。 +5. 对授权类型 ![L](assets/formula/LL-inlined-light.svg#gh-light-mode-only)![L](assets/formula/LL-inlined-dark.svg#gh-dark-mode-only) 使用算法4得到签名 ![(rl,sl)](assets/formula/52-light.svg#gh-light-mode-only)![(rl,sl)](assets/formula/52-dark.svg#gh-dark-mode-only),其中私钥见第6节。 要求 ![rl](assets/formula/53-light.svg#gh-light-mode-only)![rl](assets/formula/53-dark.svg#gh-dark-mode-only) 和 ![sl](assets/formula/54-light.svg#gh-light-mode-only)![sl](assets/formula/54-dark.svg#gh-dark-mode-only) 的长度都不得超过240比特,否则重复该步骤。 From 80c7f8e6ead38a1b0da0ebb51ea37ed8feac1805 Mon Sep 17 00:00:00 2001 From: bitcookies Date: Thu, 10 Feb 2022 14:00:19 +0800 Subject: [PATCH 11/11] =?UTF-8?q?=F0=9F=8C=99=20Adapt=20the=20Github=20Dar?= =?UTF-8?q?k=20Theme?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 🌙 Adapt the Github Dark Theme --- README.HOW_DOES_IT_WORK.md | 238 +++++++++++++++++++------------ README.HOW_DOES_IT_WORK.zh-CN.md | 36 +---- 2 files changed, 150 insertions(+), 124 deletions(-) diff --git a/README.HOW_DOES_IT_WORK.md b/README.HOW_DOES_IT_WORK.md index 585d17b..02cfe7f 100644 --- a/README.HOW_DOES_IT_WORK.md +++ b/README.HOW_DOES_IT_WORK.md @@ -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 ![GF2p15p17-inlined](assets/formula/GF2p15p17-inlined-light.svg#gh-light-mode-only) ![GF2p15p17-inlined](assets/formula/GF2p15p17-inlined-dark.svg#gh-dark-mode-only). -## 1. Composite field ![GF2p15p17-inlined] +## 1. Composite field ![GF2p15p17-inlined](assets/formula/GF2p15p17-inlined-light.svg#gh-light-mode-only) ![GF2p15p17-inlined](assets/formula/GF2p15p17-inlined-dark.svg#gh-dark-mode-only) -Elements in ground field ![GF2p15-inlined] are represented with standard basis, i.e. polynomial basis. The irreducible polynomial is +Elements in ground field ![GF2p15-inlined](assets/formula/GF2p15-inlined-light.svg#gh-light-mode-only)![GF2p15-inlined](assets/formula/GF2p15-inlined-dark.svg#gh-dark-mode-only) are represented with standard basis, i.e. polynomial basis. The irreducible polynomial is

- +

-where each coefficients is in ![GF2-inlined]. If we use + +where each coefficients is in ![GF2-inlined](assets/formula/GF2-inlined-light.svg#gh-light-mode-only)![GF2-inlined](assets/formula/GF2-inlined-dark.svg#gh-dark-mode-only). If we use

- +

-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 ![A](assets/formula/AA-inlined-light.svg#gh-light-mode-only)![A](assets/formula/AA-inlined-dark.svg#gh-dark-mode-only) in ![GF2p15-inlined](assets/formula/GF2p15-inlined-light.svg#gh-light-mode-only)![GF2p15-inlined](assets/formula/GF2p15-inlined-dark.svg#gh-dark-mode-only) can be denoted as

- +

+ --- -The irreducible polynomial of composite field ![GF2p15p17-inlined] is +The irreducible polynomial of composite field ![GF2p15p17-inlined](assets/formula/GF2p15p17-inlined-light.svg#gh-light-mode-only) ![GF2p15p17-inlined](assets/formula/GF2p15p17-inlined-dark.svg#gh-dark-mode-only) is

- +

-where each coefficients is in ![GF2p15-inlined]. If we use + +where each coefficients is in ![GF2p15-inlined](assets/formula/GF2p15-inlined-light.svg#gh-light-mode-only)![GF2p15-inlined](assets/formula/GF2p15-inlined-dark.svg#gh-dark-mode-only). If we use

- +

-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 ![B](assets/formula/BB-inlined-light.svg#gh-light-mode-only)![B](assets/formula/BB-inlined-dark.svg#gh-dark-mode-only) in ![GF2p15p17-inlined](assets/formula/GF2p15p17-inlined-light.svg#gh-light-mode-only) ![GF2p15p17-inlined](assets/formula/GF2p15p17-inlined-dark.svg#gh-dark-mode-only) can be denoted as

- +

+ --- -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 ![D](assets/formula/DD-inlined-light.svg#gh-light-mode-only)![D](assets/formula/DD-inlined-dark.svg#gh-dark-mode-only) , which is a 255-bits-long integer to denote an element ![B](assets/formula/BB-inlined-light.svg#gh-light-mode-only)![B](assets/formula/BB-inlined-dark.svg#gh-dark-mode-only) in ![GF2p15p17-inlined](assets/formula/GF2p15p17-inlined-light.svg#gh-light-mode-only) ![GF2p15p17-inlined](assets/formula/GF2p15p17-inlined-dark.svg#gh-dark-mode-only). The map between them is

- +

-## 2. Elliptic curve over ![GF2p15p17-inlined] + +## 2. Elliptic curve over ![GF2p15p17-inlined](assets/formula/GF2p15p17-inlined-light.svg#gh-light-mode-only) ![GF2p15p17-inlined](assets/formula/GF2p15p17-inlined-dark.svg#gh-dark-mode-only) The equation of the elliptic curve that WinRAR uses is

- +

-The base point ![G-inlined] is + +The base point ![G](assets/formula/GG-inlined-light.svg#gh-light-mode-only)![G](assets/formula/GG-inlined-dark.svg#gh-dark-mode-only) is

- +

-whose order ![n-inlined] is + +whose order ![n](assets/formula/n-inlined-light.svg#gh-light-mode-only)![n](assets/formula/n-inlined-dark.svg#gh-dark-mode-only) is

- +

+ ## 3. Message hash algorithm We use

- +

-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 ![l](assets/formula/l-inlined-light.svg#gh-light-mode-only)![l](assets/formula/l-inlined-dark.svg#gh-dark-mode-only). So the SHA1 value of ![M](assets/formula/MM-inlined-light.svg#gh-light-mode-only)![M](assets/formula/MM-inlined-dark.svg#gh-dark-mode-only) should be

- +

-where ![](http://latex.codecogs.com/svg.latex?%5Cinline%20S_0%2CS_1%2CS_2%2CS_3%2CS_4) 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 ![s0,4](assets/formula/13-light.svg#gh-light-mode-only)![s0,4](assets/formula/13-dark.svg#gh-dark-mode-only) 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](assets/formula/h-inlined-light.svg#gh-light-mode-only)![h](assets/formula/h-inlined-dark.svg#gh-dark-mode-only) as the hash of the input message.

- +

+ ## 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 ![k](assets/formula/k-inlined-light.svg#gh-light-mode-only)![k](assets/formula/k-inlined-dark.svg#gh-dark-mode-only) to denote private key, ![P](assets/formula/PP-inlined-light.svg#gh-light-mode-only)![P](assets/formula/PP-inlined-dark.svg#gh-dark-mode-only) to denote public key. So there must be

- +

-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 ![](http://latex.codecogs.com/svg.latex?%5Cinline%200%3CRnd%3Cn). +If we use ![h](assets/formula/h-inlined-light.svg#gh-light-mode-only)![h](assets/formula/h-inlined-dark.svg#gh-dark-mode-only) 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 ![Rnd](assets/formula/Rnd-inlined-light.svg#gh-light-mode-only)![Rnd](assets/formula/Rnd-inlined-dark.svg#gh-dark-mode-only) which satisfies ![RND](assets/formula/18-light.svg#gh-light-mode-only)![RND](assets/formula/18-dark.svg#gh-dark-mode-only). + +2. Calculate ![r](assets/formula/r-inlined-light.svg#gh-light-mode-only)![r](assets/formula/r-inlined-dark.svg#gh-dark-mode-only)

- + +

- where ![](http://latex.codecogs.com/svg.latex?%5Cinline%20%28Rnd%20%5Ccdot%20G%29_x) means we take X coordinate of ![](http://latex.codecogs.com/svg.latex?%5Cinline%20Rnd%20%5Ccdot%20G) and convert it from ![GF2p15p17-inlined] to a big integer. - If ![](http://latex.codecogs.com/svg.latex?%5Cinline%20r%3D0) or ![](http://latex.codecogs.com/svg.latex?%5Cinline%20r+Rnd%3Dn), go back to step 1. + where ![RNDGx](assets/formula/20-light.svg#gh-light-mode-only)![RNDGx](assets/formula/20-dark.svg#gh-dark-mode-only) means we take X coordinate of ![RNDG](assets/formula/21-light.svg#gh-light-mode-only)![RNDG](assets/formula/21-dark.svg#gh-dark-mode-only) and convert it from ![GF2p15p17-inlined](assets/formula/GF2p15p17-inlined-light.svg#gh-light-mode-only) ![GF2p15p17-inlined](assets/formula/GF2p15p17-inlined-dark.svg#gh-dark-mode-only) to a big integer. -3. Calculate ![s-inlined] + If ![r=0](assets/formula/22-light.svg#gh-light-mode-only)![r=0](assets/formula/22-dark.svg#gh-dark-mode-only) or ![rRnd](assets/formula/23-light.svg#gh-light-mode-only)![rRnd](assets/formula/23-dark.svg#gh-dark-mode-only), go back to step 1. + +3. Calculate ![s](assets/formula/s-inlined-light.svg#gh-light-mode-only)![s](assets/formula/s-inlined-dark.svg#gh-dark-mode-only)

- + +

- If ![](http://latex.codecogs.com/svg.latex?%5Cinline%20s%3D0), go back to step 1. -4. Output ![](http://latex.codecogs.com/svg.latex?%5Cinline%20%28r%2Cs%29). + If ![s=0](assets/formula/25-light.svg#gh-light-mode-only)![s=0](assets/formula/25-dark.svg#gh-dark-mode-only), go back to step 1. + +4. Output ![(r,s)](assets/formula/17-light.svg#gh-light-mode-only)![(r,s)](assets/formula/17-dark.svg#gh-dark-mode-only). ## 5. WinRAR private key generation algorithm We use

- + +

-to denote input data whose length is ![l-inlined]. WinRAR use it to generate private key ![k-inlined]. -1. We use ![](http://latex.codecogs.com/svg.latex?%5Cinline%20g_0%2Cg_1%2Cg_2%2Cg_3%2Cg_4%2Cg_5) to denote 6 32-bits-long integer. So there is +to denote input data whose length is ![l](assets/formula/l-inlined-light.svg#gh-light-mode-only)![l](assets/formula/l-inlined-dark.svg#gh-dark-mode-only). WinRAR use it to generate private key ![k](assets/formula/k-inlined-light.svg#gh-light-mode-only)![k](assets/formula/k-inlined-dark.svg#gh-dark-mode-only). + +1. We use ![g0-5](assets/formula/27-light.svg#gh-light-mode-only)![g0-5](assets/formula/27-dark.svg#gh-dark-mode-only) to denote 6 32-bits-long integer. So there is

- + +

-2. Let ![](http://latex.codecogs.com/svg.latex?%5Cinline%20g_0%3D0). +2. Let ![g0=0](assets/formula/29-light.svg#gh-light-mode-only)![g0=0](assets/formula/29-dark.svg#gh-dark-mode-only). -3. If ![](http://latex.codecogs.com/svg.latex?%5Cinline%20l%5Cneq%200), we calculate SHA1 value of ![T-inlined]. Then assign SHA1 state value ![](http://latex.codecogs.com/svg.latex?%5Cinline%20S_i) to ![](http://latex.codecogs.com/svg.latex?%5Cinline%20g_%7Bi+1%7D): +3. If ![l!=0](assets/formula/30-light.svg#gh-light-mode-only)![l!=0](assets/formula/30-dark.svg#gh-dark-mode-only), we calculate SHA1 value of ![T](assets/formula/TT-inlined-light.svg#gh-light-mode-only)![T](assets/formula/TT-inlined-dark.svg#gh-dark-mode-only). Then assign SHA1 state value ![Si](assets/formula/31-light.svg#gh-light-mode-only)![Si](assets/formula/31-dark.svg#gh-dark-mode-only) to ![gi+1](assets/formula/32-light.svg#gh-light-mode-only)![gi+1](assets/formula/32-dark.svg#gh-dark-mode-only):

- + +

- Otherwise, when ![](http://latex.codecogs.com/svg.latex?%5Cinline%20l%3D0), we let + + Otherwise, when ![l=0](assets/formula/34-light.svg#gh-light-mode-only)![l=0](assets/formula/34-dark.svg#gh-dark-mode-only), we let

- + +

-4. Regard ![](http://latex.codecogs.com/svg.latex?%5Cinline%20g_0) as counter, add itself by 1. +4. Regard ![g0](assets/formula/36-light.svg#gh-light-mode-only)![g0](assets/formula/36-dark.svg#gh-dark-mode-only) as counter, add itself by 1. Calculate SHA1:

- + +

- We takes the lowest 16 bits of ![](http://latex.codecogs.com/svg.latex?%5Cinline%20S_0) and donote it as ![](http://latex.codecogs.com/svg.latex?%5Cinline%20k_%7Bg_0%7D). + + We takes the lowest 16 bits of ![S0](assets/formula/38-light.svg#gh-light-mode-only)![S0](assets/formula/38-dark.svg#gh-dark-mode-only) and donote it as ![Kg0](assets/formula/39-light.svg#gh-light-mode-only)![Kg0](assets/formula/39-dark.svg#gh-dark-mode-only). 5. Repeat step 4 again with 14 times. -6. After that, we will get ![](http://latex.codecogs.com/svg.latex?%5Cinline%20k_1%2Ck_2%2Ck_3%2C%5Cldots%2Ck_%7B15%7D). Then output private key +6. After that, we will get ![k1-15](assets/formula/40-light.svg#gh-light-mode-only)![k1-15](assets/formula/40-dark.svg#gh-dark-mode-only). Then output private key

- + +

## 6. The private key and public key of WinRAR -Private key ![k-inlined] is +Private key ![k](assets/formula/k-inlined-light.svg#gh-light-mode-only)![k](assets/formula/k-inlined-dark.svg#gh-dark-mode-only) is

- + +

-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 ![T](assets/formula/TT-inlined-light.svg#gh-light-mode-only)![T](assets/formula/TT-inlined-dark.svg#gh-dark-mode-only) is zero. + +Public key ![P](assets/formula/PP-inlined-light.svg#gh-light-mode-only)![P](assets/formula/PP-inlined-dark.svg#gh-dark-mode-only) is

- + +

+ ## 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

- + +

2. License type, an ANSI-encoded string, without null-terminator. Denoted as

- + +

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 ![](http://latex.codecogs.com/svg.latex?%5Cinline%20k_U) and public key ![](http://latex.codecogs.com/svg.latex?%5Cinline%20P_U). 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 ![U](assets/formula/UU-inlined-light.svg#gh-light-mode-only)![U](assets/formula/UU-inlined-dark.svg#gh-dark-mode-only), to generate private key ![ku](assets/formula/46-light.svg#gh-light-mode-only)![ku](assets/formula/46-dark.svg#gh-dark-mode-only) and public key ![pu](assets/formula/47-light.svg#gh-light-mode-only)![pu](assets/formula/47-dark.svg#gh-dark-mode-only). Then output hexlified public key string with SM2 compressed public key format. The hexlified public key is denoted as ![Temp](assets/formula/Temp-inlined-light.svg#gh-light-mode-only)![Temp](assets/formula/Temp-inlined-dark.svg#gh-dark-mode-only). - The length of ![Temp-inlined] should be 64. If less, pad with `'0'` until the length is 64. + The length of ![Temp](assets/formula/Temp-inlined-light.svg#gh-light-mode-only)![Temp](assets/formula/Temp-inlined-dark.svg#gh-dark-mode-only) should be 64. If less, pad with `'0'` until the length is 64. -2. Let ![Data3-inlined] be +2. Let ![Data3](assets/formula/Data3-inlined-light.svg#gh-light-mode-only)![Data3](assets/formula/Data3-inlined-dark.svg#gh-dark-mode-only) be

- + +

-3. Use the algorithm describled in section 5, with argument ![Data3-inlined], to generate private key ![](http://latex.codecogs.com/svg.latex?%5Cinline%20k_%7BData%5E3%7D) and public key ![](http://latex.codecogs.com/svg.latex?%5Cinline%20P_%7BData%5E3%7D). 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 ![Data3](assets/formula/Data3-inlined-light.svg#gh-light-mode-only)![Data3](assets/formula/Data3-inlined-dark.svg#gh-dark-mode-only), to generate private key ![kdata3](assets/formula/49-light.svg#gh-light-mode-only)![kdata3](assets/formula/49-dark.svg#gh-dark-mode-only) and public key ![pdata3](assets/formula/50-light.svg#gh-light-mode-only)![pdata3](assets/formula/50-dark.svg#gh-dark-mode-only). Then output hexlified public key string with SM2 compressed public key format. The hexlified public key is denoted as ![Data0](assets/formula/Data0-inlined-light.svg#gh-light-mode-only)![Data0](assets/formula/Data0-inlined-dark.svg#gh-dark-mode-only). - The length of ![Data0-inlined] should be 64. If less, pad with `'0'` until the length is 64. + The length of ![Data0](assets/formula/Data0-inlined-light.svg#gh-light-mode-only)![Data0](assets/formula/Data0-inlined-dark.svg#gh-dark-mode-only) should be 64. If less, pad with `'0'` until the length is 64. -4. Let ![UID-inlined] be +4. Let ![UID](assets/formula/UID-inlined-light.svg#gh-light-mode-only)![UID](assets/formula/UID-inlined-dark.svg#gh-dark-mode-only) be

- + +

-5. Use the algorithm describled in section 4, with argument ![LL-inlined] and private key ![k-inlined] describled section 6, to get signature ![](http://latex.codecogs.com/svg.latex?%5Cinline%20%28r_L%2Cs_L%29). +5. Use the algorithm describled in section 4, with argument ![L](assets/formula/LL-inlined-light.svg#gh-light-mode-only)![L](assets/formula/LL-inlined-dark.svg#gh-dark-mode-only) and private key ![k](assets/formula/k-inlined-light.svg#gh-light-mode-only)![k](assets/formula/k-inlined-dark.svg#gh-dark-mode-only) describled section 6, to get signature ![(rl,sl)](assets/formula/52-light.svg#gh-light-mode-only)![(rl,sl)](assets/formula/52-dark.svg#gh-dark-mode-only). - The bit length of ![](http://latex.codecogs.com/svg.latex?%5Cinline%20r_L) and ![](http://latex.codecogs.com/svg.latex?%5Cinline%20s_L) shall not be more than 240. Otherwise, repeat this step. + The bit length of ![rl](assets/formula/53-light.svg#gh-light-mode-only)![rl](assets/formula/53-dark.svg#gh-dark-mode-only) and ![sl](assets/formula/54-light.svg#gh-light-mode-only)![sl](assets/formula/54-dark.svg#gh-dark-mode-only) shall not be more than 240. Otherwise, repeat this step. -6. Convert ![](http://latex.codecogs.com/svg.latex?%5Cinline%20r_L) and ![](http://latex.codecogs.com/svg.latex?%5Cinline%20s_L) to hex-integer string ![](http://latex.codecogs.com/svg.latex?%5Cinline%20SZ%5E%7Br_L%7D) and ![](http://latex.codecogs.com/svg.latex?%5Cinline%20SZ%5E%7Bs_L%7D), without `"0x"` prefix. +6. Convert ![rl](assets/formula/53-light.svg#gh-light-mode-only)![rl](assets/formula/53-dark.svg#gh-dark-mode-only) and ![sl](assets/formula/54-light.svg#gh-light-mode-only)![sl](assets/formula/54-dark.svg#gh-dark-mode-only) to hex-integer string ![SZrl](assets/formula/55-light.svg#gh-light-mode-only)![SZrl](assets/formula/55-dark.svg#gh-dark-mode-only) and ![SZsl](assets/formula/56-light.svg#gh-light-mode-only)![SZsl](assets/formula/56-dark.svg#gh-dark-mode-only), without `"0x"` prefix. - If the length of ![](http://latex.codecogs.com/svg.latex?%5Cinline%20SZ%5E%7Br_L%7D) or ![](http://latex.codecogs.com/svg.latex?%5Cinline%20SZ%5E%7Bs_L%7D) is less than 60, pad character `'0'` until the length is 60. + If the length of ![SZrl](assets/formula/55-light.svg#gh-light-mode-only)![SZrl](assets/formula/55-dark.svg#gh-dark-mode-only) or ![SZsl](assets/formula/56-light.svg#gh-light-mode-only)![SZsl](assets/formula/56-dark.svg#gh-dark-mode-only) is less than 60, pad character `'0'` until the length is 60. -7. Let ![Data1-inlined] be +7. Let ![Data1](assets/formula/Data1-inlined-light.svg#gh-light-mode-only)![Data1](assets/formula/Data1-inlined-dark.svg#gh-dark-mode-only) be

- + +

-8. Let ![Temp-inlined] be +8. Let ![Temp](assets/formula/Temp-inlined-light.svg#gh-light-mode-only)![Temp](assets/formula/Temp-inlined-dark.svg#gh-dark-mode-only) be

- + +

- Use the algorithm describled in section 4, with argument ![Temp-inlined] and private key ![k-inlined] describled section 6, to get signature ![](http://latex.codecogs.com/svg.latex?%5Cinline%20%28r_%7BTemp%7D%2Cs_%7BTemp%7D%29). - The bit length of ![](http://latex.codecogs.com/svg.latex?%5Cinline%20r_%7BTemp%7D) and ![](http://latex.codecogs.com/svg.latex?%5Cinline%20s_%7BTemp%7D) shall not be more than 240. Otherwise, repeat this step. + Use the algorithm describled in section 4, with argument ![Temp](assets/formula/Temp-inlined-light.svg#gh-light-mode-only)![Temp](assets/formula/Temp-inlined-dark.svg#gh-dark-mode-only) and private key ![k](assets/formula/k-inlined-light.svg#gh-light-mode-only)![k](assets/formula/k-inlined-dark.svg#gh-dark-mode-only) describled section 6, to get signature ![(rTemp,sTemp)](assets/formula/59-light.svg#gh-light-mode-only)![(rTemp,sTemp)](assets/formula/59-dark.svg#gh-dark-mode-only). -9. Convert ![](http://latex.codecogs.com/svg.latex?%5Cinline%20r_%7BTemp%7D) and ![](http://latex.codecogs.com/svg.latex?%5Cinline%20s_%7BTemp%7D) to hex-integer string ![](http://latex.codecogs.com/svg.latex?%5Cinline%20SZ%5E%7Br_%7BTemp%7D%7D) and ![](http://latex.codecogs.com/svg.latex?%5Cinline%20SZ%5E%7Bs_%7BTemp%7D%7D), without `"0x"` prefix. + The bit length of ![rTemp](assets/formula/60-light.svg#gh-light-mode-only)![rTemp](assets/formula/60-dark.svg#gh-dark-mode-only) and ![sTemp](assets/formula/61-light.svg#gh-light-mode-only)![sTemp](assets/formula/61-dark.svg#gh-dark-mode-only) shall not be more than 240. Otherwise, repeat this step. - If the length of ![](http://latex.codecogs.com/svg.latex?%5Cinline%20SZ%5E%7Br_%7BTemp%7D%7D) or ![](http://latex.codecogs.com/svg.latex?%5Cinline%20SZ%5E%7Bs_%7BTemp%7D%7D) is less than 60, pad character `'0'` until the length is 60. +9. Convert ![rTemp](assets/formula/60-light.svg#gh-light-mode-only)![rTemp](assets/formula/60-dark.svg#gh-dark-mode-only) and ![sTemp](assets/formula/61-light.svg#gh-light-mode-only)![sTemp](assets/formula/61-dark.svg#gh-dark-mode-only) to hex-integer string ![SZrTemp](assets/formula/62-light.svg#gh-light-mode-only)![SZrTemp](assets/formula/62-dark.svg#gh-dark-mode-only) and ![SZsTemp](assets/formula/63-light.svg#gh-light-mode-only)![SZsTemp](assets/formula/63-dark.svg#gh-dark-mode-only), without `"0x"` prefix. -10. Let ![Data2-inlined] be + If the length of ![SZrTemp](assets/formula/62-light.svg#gh-light-mode-only)![SZrTemp](assets/formula/62-dark.svg#gh-dark-mode-only) or ![SZsTemp](assets/formula/63-light.svg#gh-light-mode-only)![SZsTemp](assets/formula/63-dark.svg#gh-dark-mode-only) is less than 60, pad character `'0'` until the length is 60. + +10. Let ![Data2](assets/formula/Data2-inlined-light.svg#gh-light-mode-only)![Data2](assets/formula/Data2-inlined-dark.svg#gh-dark-mode-only) be

- + +

11. Calculate CRC32 value of

- + +

+ The final checksum the complement of CRC32 value. - Then convert the checksum to decimal string ![](http://latex.codecogs.com/svg.latex?%5Cinline%20SZ%5E%7Bchecksum%7D). If the length is less than 10, pad character `'0'` until the length is 10. + Then convert the checksum to decimal string ![SZchecksum](assets/formula/66-light.svg#gh-light-mode-only)![SZchecksum](assets/formula/66-dark.svg#gh-dark-mode-only). If the length is less than 10, pad character `'0'` until the length is 10. -12. Let ![Data-inlined] be +12. Let ![Data](assets/formula/Data-inlined-light.svg#gh-light-mode-only)![Data](assets/formula/Data-inlined-dark.svg#gh-dark-mode-only) be

- + +

13. Output with format @@ -287,8 +343,8 @@ The following is the algorithm to generate `rarreg.key`. * UID, taking one line, with format:

- + +

- - * Output ![Data-inlined], with 54 characters a line. - + + * Output ![Data](assets/formula/Data-inlined-light.svg#gh-light-mode-only)![Data](assets/formula/Data-inlined-dark.svg#gh-dark-mode-only), with 54 characters a line. diff --git a/README.HOW_DOES_IT_WORK.zh-CN.md b/README.HOW_DOES_IT_WORK.zh-CN.md index ecbf04b..1587e06 100644 --- a/README.HOW_DOES_IT_WORK.zh-CN.md +++ b/README.HOW_DOES_IT_WORK.zh-CN.md @@ -11,22 +11,18 @@ WinRAR 使用了基于 ECC 的签名算法来生成 `rarreg.key` 文件,其使

-各项系数全部位于 ![GF2p15-inlined](assets/formula/GF2-inlined-light.svg#gh-light-mode-only)![GF2p15-inlined](assets/formula/GF2-inlined-dark.svg#gh-dark-mode-only)。设基域的标准基为: +各项系数全部位于 ![GF2-inlined](assets/formula/GF2-inlined-light.svg#gh-light-mode-only)![GF2-inlined](assets/formula/GF2-inlined-dark.svg#gh-dark-mode-only)。设基域的标准基为:

- - 则位于基域 ![GF2p15-inlined](assets/formula/GF2p15-inlined-light.svg#gh-light-mode-only)![GF2p15-inlined](assets/formula/GF2p15-inlined-dark.svg#gh-dark-mode-only) 上的元素 ![A](assets/formula/AA-inlined-light.svg#gh-light-mode-only)![A](assets/formula/AA-inlined-dark.svg#gh-dark-mode-only) 可以用如下方式表达:

- - --- 复合域 ![GF2p15p17-inlined](assets/formula/GF2p15p17-inlined-light.svg#gh-light-mode-only) ![GF2p15p17-inlined](assets/formula/GF2p15p17-inlined-dark.svg#gh-dark-mode-only) 的不可约多项式为: @@ -35,24 +31,18 @@ WinRAR 使用了基于 ECC 的签名算法来生成 `rarreg.key` 文件,其使

- - 各项系数全部位于 ![GF2p15-inlined](assets/formula/GF2p15-inlined-light.svg#gh-light-mode-only)![GF2p15-inlined](assets/formula/GF2p15-inlined-dark.svg#gh-dark-mode-only)。设复合域的标准基为:

- - 则位于复合域 ![GF2p15p17-inlined](assets/formula/GF2p15p17-inlined-light.svg#gh-light-mode-only) ![GF2p15p17-inlined](assets/formula/GF2p15p17-inlined-dark.svg#gh-dark-mode-only) 上的元素 ![B](assets/formula/BB-inlined-light.svg#gh-light-mode-only)![B](assets/formula/BB-inlined-dark.svg#gh-dark-mode-only) 可以用如下方式表达:

- - --- 为了方便表述我们用255比特的大数 ![D](assets/formula/DD-inlined-light.svg#gh-light-mode-only)![D](assets/formula/DD-inlined-dark.svg#gh-dark-mode-only) 来表示位于复合域 ![GF2p15p17-inlined](assets/formula/GF2p15p17-inlined-light.svg#gh-light-mode-only) ![GF2p15p17-inlined](assets/formula/GF2p15p17-inlined-dark.svg#gh-dark-mode-only) 上的元素 ![B](assets/formula/BB-inlined-light.svg#gh-light-mode-only)![B](assets/formula/BB-inlined-dark.svg#gh-dark-mode-only)。它们的对应关系为: @@ -61,8 +51,6 @@ WinRAR 使用了基于 ECC 的签名算法来生成 `rarreg.key` 文件,其使

- - ## 2. 复合域 ![GF2p15p17-inlined](assets/formula/GF2p15p17-inlined-light.svg#gh-light-mode-only) ![GF2p15p17-inlined](assets/formula/GF2p15p17-inlined-dark.svg#gh-dark-mode-only) 上的椭圆曲线 曲线方程为: @@ -71,24 +59,18 @@ WinRAR 使用了基于 ECC 的签名算法来生成 `rarreg.key` 文件,其使

- - 基点 ![G](assets/formula/GG-inlined-light.svg#gh-light-mode-only)![G](assets/formula/GG-inlined-dark.svg#gh-dark-mode-only) 为:

- - 基点 ![G](assets/formula/GG-inlined-light.svg#gh-light-mode-only)![G](assets/formula/GG-inlined-dark.svg#gh-dark-mode-only) 的阶 ![n](assets/formula/n-inlined-light.svg#gh-light-mode-only)![n](assets/formula/n-inlined-dark.svg#gh-dark-mode-only) 为:

- - ## 3. 消息哈希算法 设长度为 ![l](assets/formula/l-inlined-light.svg#gh-light-mode-only)![l](assets/formula/l-inlined-dark.svg#gh-dark-mode-only) 的消息为: @@ -97,16 +79,12 @@ WinRAR 使用了基于 ECC 的签名算法来生成 `rarreg.key` 文件,其使

- - 则消息 ![M](assets/formula/MM-inlined-light.svg#gh-light-mode-only)![M](assets/formula/MM-inlined-dark.svg#gh-dark-mode-only) 的 SHA1 值为:

- - 其中 ![s0,4](assets/formula/13-light.svg#gh-light-mode-only)![s0,4](assets/formula/13-dark.svg#gh-dark-mode-only) 为 SHA1 算法输出时的5个状态值;将这5个状态值按照大端字节序依次输出,即为的 SHA1 哈希值 ![SHA1M](assets/formula/14-light.svg#gh-light-mode-only)![SHA1M](assets/formula/14-dark.svg#gh-dark-mode-only)。 WinRAR 在做完 SHA1 计算后,采用大数 ![h](assets/formula/h-inlined-light.svg#gh-light-mode-only)![h](assets/formula/h-inlined-dark.svg#gh-dark-mode-only) 作为 ECC 签名时消息的哈希: @@ -124,8 +102,6 @@ WinRAR 在做完 SHA1 计算后,采用大数 ![h](assets/formula/h-inlined-lig

- - 消息哈希为 ![h](assets/formula/h-inlined-light.svg#gh-light-mode-only)![h](assets/formula/h-inlined-dark.svg#gh-dark-mode-only),则签名 ![(r,s)](assets/formula/17-light.svg#gh-light-mode-only)![(r,s)](assets/formula/17-dark.svg#gh-dark-mode-only) 为: 1. 生成随机数 ![Rnd](assets/formula/Rnd-inlined-light.svg#gh-light-mode-only)![Rnd](assets/formula/Rnd-inlined-dark.svg#gh-dark-mode-only),满足 ![RND](assets/formula/18-light.svg#gh-light-mode-only)![RND](assets/formula/18-dark.svg#gh-dark-mode-only)。 @@ -162,8 +138,6 @@ WinRAR 在做完 SHA1 计算后,采用大数 ![h](assets/formula/h-inlined-lig

- - 来生成私钥 ![k](assets/formula/k-inlined-light.svg#gh-light-mode-only)![k](assets/formula/k-inlined-dark.svg#gh-dark-mode-only)。 1. 设6个32位整数为 ![g0-5](assets/formula/27-light.svg#gh-light-mode-only)![g0-5](assets/formula/27-dark.svg#gh-dark-mode-only),则有 @@ -175,7 +149,7 @@ WinRAR 在做完 SHA1 计算后,采用大数 ![h](assets/formula/h-inlined-lig 2. 令 ![g0=0](assets/formula/29-light.svg#gh-light-mode-only)![g0=0](assets/formula/29-dark.svg#gh-dark-mode-only)。 -3. 如果 ![l!=0](assets/formula/30-light.svg#gh-light-mode-only)![l!=0](assets/formula/30-dark.svg#gh-dark-mode-only) 则计算 ![TT](assets/formula/TT-inlined-light.svg#gh-light-mode-only)![T](assets/formula/TT-inlined-dark.svg#gh-dark-mode-only) 的 SHA1 值,并将状态值 ![Si](assets/formula/31-light.svg#gh-light-mode-only)![Si](assets/formula/31-dark.svg#gh-dark-mode-only) 赋值给 ![gi+1](assets/formula/32-light.svg#gh-light-mode-only)![gi+1](assets/formula/32-dark.svg#gh-dark-mode-only): +3. 如果 ![l!=0](assets/formula/30-light.svg#gh-light-mode-only)![l!=0](assets/formula/30-dark.svg#gh-dark-mode-only) 则计算 ![T](assets/formula/TT-inlined-light.svg#gh-light-mode-only)![T](assets/formula/TT-inlined-dark.svg#gh-dark-mode-only) 的 SHA1 值,并将状态值 ![Si](assets/formula/31-light.svg#gh-light-mode-only)![Si](assets/formula/31-dark.svg#gh-dark-mode-only) 赋值给 ![gi+1](assets/formula/32-light.svg#gh-light-mode-only)![gi+1](assets/formula/32-dark.svg#gh-dark-mode-only):

@@ -219,8 +193,6 @@ WinRAR 的私钥 ![k](assets/formula/k-inlined-light.svg#gh-light-mode-only)![k]

- - 该私钥是通过算法5生成的,其中数据 ![T](assets/formula/TT-inlined-light.svg#gh-light-mode-only)![T](assets/formula/TT-inlined-dark.svg#gh-dark-mode-only) 的长度为0。 公钥 ![P](assets/formula/PP-inlined-light.svg#gh-light-mode-only)![P](assets/formula/PP-inlined-dark.svg#gh-dark-mode-only) 为: @@ -229,8 +201,6 @@ WinRAR 的私钥 ![k](assets/formula/k-inlined-light.svg#gh-light-mode-only)![k]

- - ## 7. 授权文件"rarreg.key"的生成 授权文件的生成需要两个参数: @@ -338,7 +308,7 @@ WinRAR 的私钥 ![k](assets/formula/k-inlined-light.svg#gh-light-mode-only)![k] * UID,占一行:

- +