📘 Update New Method

This commit is contained in:
bitcookies
2024-05-16 16:01:41 +08:00
parent ef605009de
commit d7f9f8ddf7
7 changed files with 558 additions and 324 deletions
+172 -127
View File
@@ -12,7 +12,7 @@
</a>
<img src="https://img.shields.io/badge/Visual%20Studio-2022-5D4298" />
<a href="https://github.com/bitcookies/winrar-keygen/actions">
<img src="https://github.com/bitcookies/winrar-keygen/actions/workflows/action_secrets.yml/badge.svg" />
<img src="https://github.com/bitcookies/winrar-keygen/actions/workflows/keygen.yml/badge.svg" />
</a>
<a href="https://github.com/bitcookies/winrar-keygen/blob/master/LICENSE">
<img alt="License" src="https://img.shields.io/github/license/bitcookies/winrar-keygen.svg" />
@@ -41,19 +41,39 @@ See [here](README.HOW_DOES_IT_WORK.md).
There are several ways to use it:
- [Use Github Actions with Secrets](#4-Use-Github-Actions-with-Secrets) *<⭐ Recommend>*
- [Use Github Actions with Push](#5-Use-Github-Actions-with-Push)
- [Build in Visual Studio](#6-Build-in-Visual-Studio)
- [Use Github Actions](#6-Use-Github-Actions)
- [Use Github Actions with Push](#7-Use-Github-Actions-with-secrets)
- [Build in Visual Studio](#8-Build-in-Visual-Studio)
## 4. Use Github Actions with Secrets
## 4. Encoding
WinRAR Keygen supports `ASCII`, `ANSI` and `UTF-8` encoding types, the following is a brief description of the three encoding types:
| Encoding | Instruction | Supported Characters |
| -------------------------------------------- | ------------------------------------------------------------ | ------------------------------------------------------------ |
| [ASCII](https://en.wikipedia.org/wiki/ASCII) | Single byte encoding only using the bottom 7 bits. (Unicode code points 0-127.) No accents etc. | Only full ASCII characters are supported. |
| ANSI | There's no one fixed ANSI encoding - there are lots of them. Usually when people say "ANSI" they mean "the default locale/codepage for my system" which is obtained via [Encoding.Default](http://msdn.microsoft.com/en-us/library/system.text.encoding.default.aspx), and is often [Windows-1252](http://en.wikipedia.org/wiki/Windows-1252) but can be other locales. | Only full ASCII characters and the language of your operating system are supported. |
| [UTF-8](https://en.wikipedia.org/wiki/UTF-8) | Variable length encoding, 1-4 bytes per code point. ASCII values are encoded as ASCII using 1 byte. | Support full UTF8 encoded characters. |
## 5. License type
There are two types of WinRAR licenses, `rarreg.key` and `rarkey.rar`, which differ only in their import.
| <img width="60px">rarreg.key<img width="60px"> | <img width="60px">rarkey.rar<img width="60px"> |
| :--------------------------------------------: | :----------------------------------------------: |
| <img width="100px" src="assets/file-icon.svg"> | <img width="100px" src="assets/winrar-icon.svg"> |
| Drag to import or place in a specific location | Double-click to run automatic import |
## 6. Use Github Actions
<details>
<summary>Click to expand</summary>
The new workflow can easily help you generate a license, you just need to follow these steps.
Use [Secrets](https://docs.github.com/en/actions/security-guides/encrypted-secrets) you don't need to commits to the repository, so you can fetch upstream without conflicts. So I recommend using this method.
> Your Username and License Name will appear in the Actions log, if you don't want to give out this information, see [7. Using Github Actions with secrets](#7-Use-Github-Actions-with-secrets).
### 4.1 Fork
### 6.1 Fork
**Fork** this repo.
@@ -61,7 +81,7 @@ Use [Secrets](https://docs.github.com/en/actions/security-guides/encrypted-secre
![Fork](assets/fork-dark.png#gh-dark-mode-only)
### 4.2 Allow Fork repo to run Workflows
### 6.2 Allow fork repo to run workflows
Go back to the repo you just forked and click **Actions** to allow Workflows to run in your forked repo.
@@ -69,122 +89,106 @@ Go back to the repo you just forked and click **Actions** to allow Workflows to
![Workflow](assets/enable-workflows-dark.png#gh-dark-mode-only)
### 4.3 Creating Secrets
### 6.3 Run WinRAR Keygen
After allowing Workflows, go to **Settings > Secrets and variables > Actions > New repository secret**.
After allowing the workflow, go to **Actions > WinRAR Keygen > Run workflow** and fill in the information to start generating.
> For the difference of license encoding, please refer to [4. Encoding](#4-Encoding).
![Secrets](assets/run-ketgen-light.png#gh-light-mode-only)
![Secrets](assets/run-ketgen-dark.png#gh-dark-mode-only)
After running successfully, open the corresponding task and select **rarreg_file** to download.
> Files are retained for 90 days and are automatically destroyed after that time.
![Download](assets/file-download-light.png#gh-light-mode-only)
![Download](assets/file-download-dark.png#gh-dark-mode-only)
After extract `rarreg_file.zip`, you will get `rarreg.key`, just drag and drop it into WinRAR. You can also compress `rarreg.key` into `rarkey.rar` and double-click it to run it, and the license import will take place automatically.
If you get an invalid key, please check [the specific solution](#9-invalid-key).
</details>
## 7. Use Github Actions with secrets
<details>
<summary>Click to expand</summary>
Using [Secrets](https://docs.github.com/en/actions/security-guides/encrypted-secrets) can help you hide license information.
### 7.1 Fork
**Fork** this repo.
![Fork](assets/fork-light.png#gh-light-mode-only)
![Fork](assets/fork-dark.png#gh-dark-mode-only)
### 7.2 Allow fork repo to run Workflows
Go back to the repo you just forked and click **Actions** to allow Workflows to run in your forked repo.
![Workflow](assets/enable-workflows-light.png#gh-light-mode-only)
![Workflow](assets/enable-workflows-dark.png#gh-dark-mode-only)
### 7.3 Create secrets
After allowing the workflow, go to **Settings > Secrets and variables > Actions > New repository secret** to create a secret.
![Secrets](assets/secrets-light.png#gh-light-mode-only)
![Secrets](assets/secrets-dark.png#gh-dark-mode-only)
Create two Secrets named `text1` and `text2` and fill in values.
Create three Secrets with the names `TEXT1`, `TEXT2` and `PWD` and fill in the relevant values.
> The value filled in should be consistent with the type of code you have chosen.
| Secrets Name | Explanation |
| ------------ | ----------------- |
| TEXT1 | Your Name |
| TEXT2 | Your License Name |
| PWD | 7-Zip Password |
![Add Secrets](assets/secrets-add-light.png#gh-light-mode-only)
![Add Secrets](assets/secrets-add-dark.png#gh-dark-mode-only)
Once created, you will see:
Once created, you will see it.
![Secrets Repo](assets/secrets-repo-light.png#gh-light-mode-only)
![Secrets Repo](assets/secrets-repo-dark.png#gh-dark-mode-only)
### 4.4 Run Workflow
### 7.4 Run workflow
Go to **Actions** and select **WinRAR Keygen Secrets** to run Workflow manually.
For the difference of license encoding, please refer to [4. Encoding](#4-Encoding).
![Run](assets/run-workflow-light.png#gh-light-mode-only)
![Run](assets/run-workflow-dark.png#gh-dark-mode-only)
After running successfully, open the corresponding task and select **rarreg_file** to download.
![Download](assets/file-download-light.png##gh-light-mode-only)
> The file will only be available for **1 day**, so please download it in time.
![Download](assets/file-download-light.png#gh-light-mode-only)
![Download](assets/file-download-dark.png#gh-dark-mode-only)
After extract `rarreg_file.zip`, you will get `rarreg.key`, just drag and drop it into WinRAR. You can also compress `rarreg.key` into `rarkey.rar` and double-click it to run it, and the license import will take place automatically.
If you get an invalid key, please check [the specific solution](#7-invalid-key).
If you get an invalid key, please check [the specific solution](#9-invalid-key).
</details>
## 5. Use Github Actions with Push
<details>
<summary>Click to expand</summary>
Using push for key generation is very simple and convenient, but when there are updates to fetch upstream, you need to manually merge conflicts. So I would recommend [Use Github Actions with Secrets](#4-Use-Github-Actions-with-Secrets), but you can still use the push action.
### 5.1 Fork
**Fork** this repo.
![Fork](assets/fork-light.png#gh-light-mode-only)
![Fork](assets/fork-dark.png#gh-dark-mode-only)
If you've forked before and I've committed new code, but you don't know how to merge the new content into your repository, then you can delete the current fork and fork again.
### 5.2 Allow Fork repo to run Workflows
Go back to the repo you just forked and click **Actions** to allow Workflows to run in your forked repo.
![Workflow](assets/enable-workflows-light.png#gh-light-mode-only)
![Workflow](assets/enable-workflows-dark.png#gh-dark-mode-only)
### 5.3 Edit info.json
Open your forked repository, and go to `keygen/info.json` and click on the edit button to edit the file.
![Edit](assets/edit-json-light.png#gh-light-mode-only)
![Edit](assets/edit-json-dark.png#gh-dark-mode-only)
You can see:
```json
{
"text1": "Github",
"text2": "Github.com"
}
```
You can modify the values corresponding to `text1` and `text2`:
```json
{
"text1": "Your Name",
"text2": "Your License"
}
```
It is important to note that `test1` and `test2` are **ANSI-encoded string, space are now supported.**
Once you have finished making changes, click the **Commit changes** button and Github Actions will start automatically.
### 5.4 Download Key
Go to **Actions** and select **WinRAR Keygen** to see the status of the program.
![Workflow](assets/push-workflows-light.png#gh-light-mode-only)
![Workflow](assets/push-workflows-dark.png#gh-dark-mode-only)
Green means it ran successfully, yellow means it is running, red means it failed. After running successfully, open the corresponding task and select **rarreg_file** to download.
![Download](assets/file-download-light.png##gh-light-mode-only)
![Download](assets/file-download-dark.png#gh-dark-mode-only)
After extract `rarreg_file.zip`, you will get `rarreg.key`, just drag and drop it into WinRAR. You can also compress `rarreg.key` into `rarkey.rar` and double-click it to run it, and the license import will take place automatically.
If you get an invalid key, please check [the specific solution](#7-invalid-key).
</details>
## 6. Build in Visual Studio
## 8. Build in Visual Studio
<details>
<summary>Click to expand</summary>
@@ -193,7 +197,7 @@ I recommend using the Github Actions, but you can still do your own compilation.
If you don't want to compile it yourself, you can also go to the [release](https://github.com/bitcookies/winrar-keygen/releases/) page to get `winrar-keygen.exe`.
### 6.1 Prerequisites
### 8.1 Prerequisites
1. Please make sure that you have **Visual Studio 2022**. Because this is a VS2022 project. If you are still using Visual Studio 2019, you can find projects for VS2019 in the [vs2019](https://github.com/bitcookies/winrar-keygen/tree/vs2019) branch, but this branch will no longer be maintained.
@@ -206,19 +210,19 @@ If you don't want to compile it yourself, you can also go to the [release](https
You can install them by:
```console
```shell
$ vcpkg install mpir:x86-windows-static
$ vcpkg install mpir:x64-windows-static
```
3. Your `vcpkg` has been integrated into your __Visual Studio__, which means you have run successfully.
```console
```shell
$ vcpkg integrate install
```
### 6.2 Build
### 8.2 Build
1. Open this project in __Visual Studio__.
@@ -228,101 +232,142 @@ If you don't want to compile it yourself, you can also go to the [release](https
You will see executable files in `bin/` directory.
### 6.3 How to Use?
### 8.3 How to use?
Execute the following code in the terminal and configure two parameters to generate `rarreg.key`.
Here is an example use `Github` and `Github.com`:
Here is an example of ASCII encoding for `Github` and `Single PC usage license`:
```
```shell
Usage:
winrar-keygen.exe <Your Name> <Your License>
winrar-keygen.exe <Username> <License Name>
Example:
winrar-keygen.exe "Github" "Github.com"
winrar-keygen.exe "Github" "Single PC usage license"
or:
winrar-keygen.exe "Github" "Github.com" > rarreg.key
or:
winrar-keygen.exe "Github" "Github.com" | Out-File -Encoding ASCII rarreg.key
```
![Terminal](assets/terminal.png)
Now you can see the newly generated file:
Now you can see the newly generated file.
```console
```shell
RAR registration data
Github
Github.com
Single PC usage license
UID=3a3d02329a32b63da7d8
6412212250a7d8753c5e7037d83011171578c57042fa30c506caae
9954e4853d415ec594e46076cc9a65338309b66c50453ba72158c0
656de97acb2f2a48cf3b75329283544c3e1b366a5062b85d0022f6
de3cdc56b311475b484e80b48157a0c3af60ca4f7f9c75d49bc50d
6bad616c1c58caa922d3ed0cd19771e8191522a586544c3e1b366a
5062b85d29db066f02e777ad78100865f2c31f2dd3a86998609b18
5eede7ed46566b10bf033daa6384062b259194b1acbd1443042646
9954e4853d415ec594e46017cb3db740bc4b32e47aea25db62f350
9f22065a27da4f8216d2938e1050b6e3347501a3767d1fdd7ee130
dd4ab952600ba16a99236d910bfa995d5f60651ec451f462511507
95b3722d059f2d5303a231e396cf21f17098edeec0b6e3347501a3
767d1fdd7ee45388769767642338ee8a63178f3458b71de5609b18
5eede7ed46566b10bf033daa6384062b259194b1acbd0378116064
```
Save the generated information in **ANSI encoding format** as `rarreg.key`.
Save the generated information in **ANSI encoding** as `rarreg.key`.
### 8.4 Multi-language support
Execute the following code in the terminal and configure two paramet
When using ANSI encoding, you can only use characters from the country or region where your operating system is located. ANSI encoding is supported from Powershell 7.4 onwards, and you will also need to [upgrade your Powershell](https://learn.microsoft.com/en-us/powershell/ scripting/install/installing-powershell-on-windows?view=powershell-7.4).
Generate multi-language licenses in ANSI encoding.
```shell
winrar-keygen.exe "简体中文" "license" | Out-File -Encoding ansi rarreg.key
winrar-keygen.exe "繁體中文" "license" | Out-File -Encoding ansi rarreg.key
winrar-keygen.exe "Deutsch" "license" | Out-File -Encoding ansi rarreg.key
winrar-keygen.exe "Français" "license" | Out-File -Encoding ansi rarreg.key
winrar-keygen.exe "日本語" "license" | Out-File -Encoding ansi rarreg.key
winrar-keygen.exe "한국어" "license" | Out-File -Encoding ansi rarreg.key
```
When generating utf-8 licenses, you may need to check Use ***Beta:Use Unicode UTF-8 for global language support*** in **Control Panel > Clock and Regions > Regions > Administration > Change System Region Settings** in order to process the data correctly. However, it is not recommended that you do this, which may cause many software to not work properly, and it is recommended to [Use Github Actions](#6-Use-Github-Actions).
Generate multi-language licenses with UTF-8 encoding.
> `utf8:` is to ensure constant character representation in WinRAR across languages.
```shell
winrar-keygen.exe "utf8:简体中文" "license" | Out-File -Encoding utf8 rarreg.key
winrar-keygen.exe "utf8:繁體中文" "license" | Out-File -Encoding utf8 rarreg.key
winrar-keygen.exe "utf8:Deutsch" "license" | Out-File -Encoding utf8 rarreg.key
winrar-keygen.exe "utf8:Français" "license" | Out-File -Encoding utf8 rarreg.key
winrar-keygen.exe "utf8:日本語" "license" | Out-File -Encoding utf8 rarreg.key
winrar-keygen.exe "utf8:한국어" "license" | Out-File -Encoding utf8 rarreg.key
```
</details>
## 7. Invalid Key
## 9. Invalid key
Why is my `rarreg.key` invalid?
### 7.1 ANSI Encoded
### 9.1 Incorrect encoding
`test1` and `test2` are **ANSI-encoded string, space are now supported** [Issues #5](https://github.com/bitcookies/winrar-keygen/issues/5).
`TEXT1` and `TEXT2` are required to fulfill [corresponding coding requirements](#4 - coding description).
```console
winrar-keygen.exe <text1> <text2>
```shell
winrar-keygen.exe <TEXT1> <TEXT2>
```
You can refer to: [Generation of "rarreg.key"](https://github.com/bitcookies/winrar-keygen/blob/master/README.HOW_DOES_IT_WORK.md#7-generation-of-rarregkey)
### 7.2 TXT Encoding
### 9.2 Key encoding
If you use the following command:
```console
winrar-keygen.exe "Github" "Github.com" > rarreg.key
```shell
winrar-keygen.exe "Github" "Single PC usage license" > rarreg.key
```
In the newer Windows 10, PowerShell will export in **UTF16-LE** format by default, which will cause the error.
Please use the following command:
```console
```shell
winrar-keygen.exe "Github" "Github.com" | Out-File -Encoding ASCII rarreg.key
```
### 7.3 Location of Key
### 9.3 Location of key
If you are unable to drag, you can try to put the `rarreg.key` in the following directory.
```console
```shell
C:\Users\yourname\AppData\Roaming\WinRAR\rarreg.key
```
You can also compress `rarreg.key` into `rarkey.rar` and double-click it to run it, and the license import will take place automatically.
## 8. Contributing
## 10. Contributing
### 8.1 Suggestion
### 10.1 Suggestion
If you encounter some problems, you can report on the [Issues](https://github.com/bitcookies/winrar-keygen/issues) page. There will be many enthusiastic developers or Github users to help you.
This project welcomes contributions and suggestions. You can make suggestions in [Issues](https://github.com/bitcookies/winrar-keygen/issues), or submit a pull request 😄
### 8.2 Thanks
### 10.2 Thanks
Thank you very much to some enthusiastic developers for helping answer some questions in [Issues](https://github.com/bitcookies/winrar-keygen/issues).
🏆 Special Thanks [@Sonic-The-Hedgehog-LNK1123](https://github.com/Sonic-The-Hedgehog-LNK1123)
## 9. License
## 11. License
The code is available under the [MIT license](https://github.com/bitcookies/winrar-keygen/blob/master/LICENSE)