📘 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

View file

@ -1,40 +0,0 @@
name: WinRAR Keygen
on:
push:
branches: [ master ]
paths:
- 'keygen/*.json'
jobs:
build:
runs-on: windows-2022
steps:
- uses: actions/checkout@v4.1.3
- name: Get key text1
id: text1
uses: notiz-dev/github-action-json-property@release
with:
path: 'keygen/info.json'
prop_path: 'text1'
- name: Get key text2
id: text2
uses: notiz-dev/github-action-json-property@release
with:
path: 'keygen/info.json'
prop_path: 'text2'
- name: Generate key
shell: powershell
run: bin/x64-Release/winrar-keygen.exe "${{steps.text1.outputs.prop}}" "${{steps.text2.outputs.prop}}" | Out-File -Encoding ASCII rarreg.key
- name: Upload key
uses: actions/upload-artifact@v4.3.3
with:
name: rarreg_file
path: rarreg.key
retention-days: 90

View file

@ -1,22 +0,0 @@
name: WinRAR Keygen Secrets
on: workflow_dispatch
jobs:
build:
runs-on: windows-2022
steps:
- uses: actions/checkout@v4.1.3
- name: Generate key
shell: powershell
run: bin/x64-Release/winrar-keygen.exe "${{secrets.TEXT1}}" "${{secrets.TEXT2}}" | Out-File -Encoding ASCII rarreg.key
- name: Upload key
uses: actions/upload-artifact@v4.3.3
with:
name: rarreg_file
path: rarreg.key
retention-days: 90

107
.github/workflows/keygen.yml vendored Normal file
View file

@ -0,0 +1,107 @@
name: WinRAR Keygen
on:
workflow_dispatch:
inputs:
KEY_ENCODING:
type: string
description: License encoding ascii, ansi or utf8
default: 'utf8'
required: true
KEY_USERNAME:
type: string
description: Input your username
required: true
KEY_LICENSE_NAME:
type: string
description: Input your license name
default: 'Single PC usage license'
required: true
jobs:
keygen-ascii:
name: Generating ASCII License
runs-on: windows-2022
env:
KEY_ENCODING: ${{ github.event.inputs.KEY_ENCODING }}
KEY_USERNAME: ${{ github.event.inputs.KEY_USERNAME }}
KEY_LICENSE_NAME: ${{ github.event.inputs.KEY_LICENSE_NAME }}
if: github.event.inputs.KEY_ENCODING == 'ascii'
steps:
- uses: actions/checkout@v4.1.5
- name: Generating License (ASCII)
# Do Not Use pwsh
shell: powershell
run: |
$OutputEncoding = [console]::InputEncoding = [console]::OutputEncoding = New-Object System.Text.UTF8Encoding
$PSVersionTable.PSVersion
bin/x64-Release/winrar-keygen.exe "${{env.KEY_USERNAME}}" "${{env.KEY_LICENSE_NAME}}" | Out-File -Encoding ${{env.KEY_ENCODING}} rarreg.key
- name: Uploading License
uses: actions/upload-artifact@v4.3.3
with:
name: rarreg_file_${{env.KEY_ENCODING}}
path: rarreg.key
if-no-files-found: error
retention-days: 90
keygen-ansi:
name: Generating ANSI License
runs-on: windows-2022
env:
KEY_ENCODING: ${{ github.event.inputs.KEY_ENCODING }}
KEY_USERNAME: ${{ github.event.inputs.KEY_USERNAME }}
KEY_LICENSE_NAME: ${{ github.event.inputs.KEY_LICENSE_NAME }}
if: github.event.inputs.KEY_ENCODING == 'ansi'
steps:
- uses: actions/checkout@v4.1.5
- name: Generating License (ANSI)
shell: pwsh
run: |
$OutputEncoding = [console]::InputEncoding = [console]::OutputEncoding = New-Object System.Text.UTF8Encoding
$OutputEncoding
bin/x64-Release/winrar-keygen.exe "${{env.KEY_USERNAME}}" "${{env.KEY_LICENSE_NAME}}"
bin/x64-Release/winrar-keygen.exe "${{env.KEY_USERNAME}}" "${{env.KEY_LICENSE_NAME}}" | Out-File -Encoding ${{env.KEY_ENCODING}} rarreg.key
- name: Uploading License
uses: actions/upload-artifact@v4.3.3
with:
name: rarreg_file_${{env.KEY_ENCODING}}
path: rarreg.key
if-no-files-found: error
retention-days: 90
keygen-uft8:
name: Generating UTF8 License
runs-on: windows-2022
env:
KEY_ENCODING: ${{ github.event.inputs.KEY_ENCODING }}
KEY_USERNAME: ${{ github.event.inputs.KEY_USERNAME }}
KEY_LICENSE_NAME: ${{ github.event.inputs.KEY_LICENSE_NAME }}
if: github.event.inputs.KEY_ENCODING == 'utf8'
steps:
- uses: actions/checkout@v4.1.5
- name: Generating License (UTF-8)
# Do Not Use pwsh
shell: powershell
run: |
$OutputEncoding = [console]::InputEncoding = [console]::OutputEncoding = New-Object System.Text.UTF8Encoding
$PSVersionTable.PSVersion
bin/x64-Release/winrar-keygen.exe "utf8:${{env.KEY_USERNAME}}" "${{env.KEY_LICENSE_NAME}}" | Out-File -Encoding ${{env.KEY_ENCODING}} rarreg.key
- name: Uploading License
uses: actions/upload-artifact@v4.3.3
with:
name: rarreg_file_${{env.KEY_ENCODING}}
path: rarreg.key
if-no-files-found: error
retention-days: 90

102
.github/workflows/keygen_secrets.yml vendored Normal file
View file

@ -0,0 +1,102 @@
name: WinRAR Keygen with secrets
on:
workflow_dispatch:
inputs:
KEY_ENCODING:
type: string
description: License encoding ascii, ansi or utf8
default: 'utf8'
required: true
jobs:
keygen-ascii:
name: Generating ASCII License
runs-on: windows-2022
env:
KEY_ENCODING: ${{ github.event.inputs.KEY_ENCODING }}
KEY_USERNAME: ${{secrets.TEXT1}}
KEY_LICENSE_NAME: ${{secrets.TEXT2}}
ZIP_PWD: ${{secrets.PWD}}
if: github.event.inputs.KEY_ENCODING == 'ascii'
steps:
- uses: actions/checkout@v4.1.5
- name: Generating License (ASCII)
# Do Not Use pwsh
shell: powershell
run: |
$OutputEncoding = [console]::InputEncoding = [console]::OutputEncoding = New-Object System.Text.UTF8Encoding
$PSVersionTable.PSVersion
bin/x64-Release/winrar-keygen.exe "${{env.KEY_USERNAME}}" "${{env.KEY_LICENSE_NAME}}" | Out-File -Encoding ${{env.KEY_ENCODING}} rarreg.key
7z a rarreg.7z rarreg.key -p"${{env.ZIP_PWD}}"
- name: Uploading License
uses: actions/upload-artifact@v4.3.3
with:
name: rarreg_file_${{env.KEY_ENCODING}}
path: rarreg.7z
if-no-files-found: error
retention-days: 1
keygen-ansi:
name: Generating ANSI License
runs-on: windows-2022
env:
KEY_ENCODING: ${{ github.event.inputs.KEY_ENCODING }}
KEY_USERNAME: ${{secrets.TEXT1}}
KEY_LICENSE_NAME: ${{secrets.TEXT2}}
ZIP_PWD: ${{secrets.PWD}}
if: github.event.inputs.KEY_ENCODING == 'ansi'
steps:
- uses: actions/checkout@v4.1.5
- name: Generating License (ANSI)
shell: pwsh
run: |
$OutputEncoding = [console]::InputEncoding = [console]::OutputEncoding = New-Object System.Text.UTF8Encoding
$OutputEncoding
bin/x64-Release/winrar-keygen.exe "${{env.KEY_USERNAME}}" "${{env.KEY_LICENSE_NAME}}"
bin/x64-Release/winrar-keygen.exe "${{env.KEY_USERNAME}}" "${{env.KEY_LICENSE_NAME}}" | Out-File -Encoding ${{env.KEY_ENCODING}} rarreg.key
7z a rarreg.7z rarreg.key -p"${{env.ZIP_PWD}}"
- name: Uploading License
uses: actions/upload-artifact@v4.3.3
with:
name: rarreg_file_${{env.KEY_ENCODING}}
path: rarreg.7z
if-no-files-found: error
retention-days: 1
keygen-uft8:
name: Generating UTF8 License
runs-on: windows-2022
env:
KEY_ENCODING: ${{ github.event.inputs.KEY_ENCODING }}
KEY_USERNAME: ${{secrets.TEXT1}}
KEY_LICENSE_NAME: ${{secrets.TEXT2}}
ZIP_PWD: ${{secrets.PWD}}
if: github.event.inputs.KEY_ENCODING == 'utf8'
steps:
- uses: actions/checkout@v4.1.5
- name: Generating License (UTF-8)
# Do Not Use pwsh
shell: powershell
run: |
$OutputEncoding = [console]::InputEncoding = [console]::OutputEncoding = New-Object System.Text.UTF8Encoding
$PSVersionTable.PSVersion
bin/x64-Release/winrar-keygen.exe "utf8:${{env.KEY_USERNAME}}" "${{env.KEY_LICENSE_NAME}}" | Out-File -Encoding ${{env.KEY_ENCODING}} rarreg.key
7z a rarreg.7z rarreg.key -p"${{env.ZIP_PWD}}"
- name: Uploading License
uses: actions/upload-artifact@v4.3.3
with:
name: rarreg_file_${{env.KEY_ENCODING}}
path: rarreg.7z
if-no-files-found: error
retention-days: 1

299
README.md
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)

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,42 @@ WinRAR 不是免费软件。如果你想使用它,你应当向 [__RARLAB__](ht
有多种方法可供选择:
+ [通过 Secrets 使用 Github Actions](#4-通过-Secrets-使用-Github-Actions) *<⭐ 推荐>*
+ [通过 Push 使用 Github Actions](#5-通过-Push-使用-Github-Actions)
+ [通过 Visual Studio 编译使用](#6-通过-Visual-Studio-编译使用)
+ [使用 Github Actions](#6-使用-Github-Actions)
+ [使用 Github Actions with secrets](#7-使用-Github-Actions-with-secrets)
+ [通过 Visual Studio 编译使用](#8-通过-Visual-Studio-编译使用)
## 4. 通过 Secrets 使用 Github Actions
## 4. 编码说明
WinRAR Keygen 支持 `ASCII`、`ANSI` 和 `UTF-8` 三种编码类型,以下是三种编码的简单说明:
> [!WARNING]
> 建议暂时先不要使用 ANSI 编码方式,因为在 Windows Server 2022 上中文、日语和韩语的 PowerShell 控制台字符会出现乱码问题,[微软正在修复该问题](https://learn.microsoft.com/en-us/troubleshoot/windows-server/system-management-components/powershell-shell-characters-garbled-for-cjk-languages)。
| 编码 | 说明 | 支持的字符 |
| -------------------------------------------- | ------------------------------------------------------------ | ----------------------------------------------------- |
| [ASCII](https://en.wikipedia.org/wiki/ASCII) | 单字节编码,只使用最下面的 7 位,没有重音符号等 | 仅支持 ASCII 字符 |
| ANSI | 没有一种固定的 ANSI 编码。通常说的 ANSI 是指 “系统默认的本地/代码页”,它通过 [Encoding.Default](http://msdn.microsoft.com/en-us/library/system.text.encoding.default.aspx) 获得,通常是 [Windows-1252](http://en.wikipedia.org/wiki/Windows-1252),但也可以是其他本地 | 仅支持 ASCII 字符和您操作系统所设国家或地区的语言编码 |
| [UTF8](https://en.wikipedia.org/wiki/UTF-8) | 可变长度编码,每个码位 1-4 个字节。ASCII 值用 1 个字节编码为 ASCII | 支持 UTF-8 编码字符 |
## 5. License 类型
WinRAR license 有 `rarreg.key``rarkey.rar` 两种类型,它们仅在导入上有区别:
| <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"> |
| 拖动导入或放于指定位置 | 双击运行自动导入 |
## 6. 使用 Github Actions
<details>
<summary>点击展开</summary>
新的 workflow 能很方便的帮助你生成 license你只需跟随以下步骤即可
使用 [Secrets](https://docs.github.com/en/actions/security-guides/encrypted-secrets) 可以不用对仓库代码进行修改,方便你以后可以无冲突的对仓库进行同步更新,所以我优先推荐使用这种方法:
> 你的 Username 和 License Name 会出现在 Actions 日志中,如果你不想泄露这些信息,请参考 [7. 使用 Github Actions with secrets](#7-使用-Github-Actions-with-secrets)。
### 4.1 Fork
### 6.1 Fork
点击该项目右上角的 **Fork** 按钮fork 一份代码到你的 Github
@ -61,23 +84,78 @@ WinRAR 不是免费软件。如果你想使用它,你应当向 [__RARLAB__](ht
![Fork](assets/fork-dark.png#gh-dark-mode-only)
### 4.2 允许 Fork 代码运行 Workflows
### 6.2 允许 Fork 仓库运行 Workflows
返回到你刚刚 fork 完成的 repo然后点击 **Actions** 去允许 Workflows 在你的 fork repo 中运行:
返回到你刚刚 fork 完成的 repo然后点击 **Actions** 去允许 workflows 在你的 fork repo 中运行:
![Workflow](assets/enable-workflows-light.png#gh-light-mode-only)
![Workflow](assets/enable-workflows-dark.png#gh-dark-mode-only)
### 4.3 创建 Secrets
### 6.3 运行 WinRAR Keygen
允许 Workflows 后,进入 **Settings > Secrets and variables > Actions > New repository secret** 来创建 Secrets
允许 workflow 后,选择 **WinRAR Keygen > Run workflow** 并填入信息就可以开始生成了:
> License 编码的区别请参考 [4. 编码说明](#4-编码说明)。
![Secrets](assets/run-ketgen-light.png#gh-light-mode-only)
![Secrets](assets/run-ketgen-dark.png#gh-dark-mode-only)
运行成功之后,打开对应的任务,选择 **rarreg_file** 下载:
> 文件保留 90 天,超出时间后会自动销毁。
![Download](assets/file-download-light.png#gh-light-mode-only)
![Download](assets/file-download-dark.png#gh-dark-mode-only)
`rarreg_file.zip` 解压缩后会得到 `rarreg.key`,然后拖动导入 WinRAR 即可。你也可以将 `rarreg.key` 压缩成 `rarkey.rar`,然后双击运行,授权导入将会自动进行。
如果你得到的是 key 是无效的,请查看 [解决方法](#9-无效的-Key)。
</details>
## 7. 使用 Github Actions with secrets
<details>
<summary>点击展开</summary>
使用 [Secrets](https://docs.github.com/en/actions/security-guides/encrypted-secrets) 可以帮助你隐藏 license 信息。
### 7.1 Fork
点击该项目右上角的 **Fork** 按钮fork 一份代码到你的 Github
![Fork](assets/fork-light.png#gh-light-mode-only)
![Fork](assets/fork-dark.png#gh-dark-mode-only)
### 7.2 允许 Fork 仓库运行 Workflows
返回到你刚刚 fork 完成的 repo然后点击 **Actions** 去允许 workflows 在你的 fork repo 中运行:
![Workflow](assets/enable-workflows-light.png#gh-light-mode-only)
![Workflow](assets/enable-workflows-dark.png#gh-dark-mode-only)
### 7.3 创建 Secrets
允许 workflows 后,进入 **Settings > Secrets and variables > Actions > New repository secret** 来创建 Secrets
![Secrets](assets/secrets-light.png#gh-light-mode-only)
![Secrets](assets/secrets-dark.png#gh-dark-mode-only)
创建两个 Secrets名称为 `text1``text2`,并填入相关值:
创建三个 Secrets名称为 `TEXT1``TEXT2``PWD`,并填入相关值:
> 填入的值应与你选择的编码类型保持一致。
| Secrets Name | Explanation |
| ------------ | ----------- |
| TEXT1 | 用户名 |
| TEXT2 | 许可名 |
| PWD | 压缩包密码 |
![Add Secrets](assets/secrets-add-light.png#gh-light-mode-only)
@ -89,9 +167,11 @@ WinRAR 不是免费软件。如果你想使用它,你应当向 [__RARLAB__](ht
![Secrets Repo](assets/secrets-repo-dark.png#gh-dark-mode-only)
### 4.4 运行 Workflow
### 7.4 运行 Workflow
进入 **Actions** 并选择 **WinRAR Keygen Secrets > Run workflow > Run workflow** 来手动执行 Workflow
进入 **Actions** 选择 **WinRAR Keygen with secrets > Run workflow** 并填入信息:
> License 编码的区别请参考 [4. 编码说明](#4-编码说明)。
![Run](assets/run-workflow-light.png#gh-light-mode-only)
@ -99,92 +179,19 @@ WinRAR 不是免费软件。如果你想使用它,你应当向 [__RARLAB__](ht
运行成功之后,打开对应的任务,选择 **rarreg_file** 下载:
![Download](assets/file-download-light.png##gh-light-mode-only)
> 文件仅保留 **1 天**,请及时下载。
![Download](assets/file-download-light.png#gh-light-mode-only)
![Download](assets/file-download-dark.png#gh-dark-mode-only)
`rarreg_file.zip` 解压缩后会得到 `rarreg.key`,然后拖动导入 WinRAR 即可。你也可以将 `rarreg.key` 压缩成 `rarkey.rar`,然后双击运行,授权导入将会自动进行。
`rarreg_file.zip` 解压缩后会得到 `rarreg.7z`,使用你设置的密码进行解压缩获得 `rarreg.key`,然后拖动导入 WinRAR 即可。你也可以将 `rarreg.key` 压缩成 `rarkey.rar`,然后双击运行,授权导入将会自动进行。
如果你得到的是 key 是无效的,请查看 [解决方法](#7-无效的-Key)。
如果你得到的是 key 是无效的,请查看 [解决方法](#9-无效的-Key)。
</details>
## 5. 通过 Push 使用 Github Actions
<details>
<summary>点击展开</summary>
使用 push 操作进行 key 的生成非常的简单和方便,但是当有更新同步时你需要手动进行冲突合并。所以我建议优先 [通过 Secrets 使用 Github Actions](#4-通过-Secrets-使用-Github-Actions) ,但是你仍可以使用 push 操作:
### 5.1 Fork
点击该项目右上角的 **Fork** 按钮fork 一份代码到你的 Github
![Fork](assets/fork-light.png#gh-light-mode-only)
![Fork](assets/fork-dark.png#gh-dark-mode-only)
如果你之前 fork 过,然后我提交了新的代码,但是你不懂得如何合并新内容到你的仓库,那你也可以删掉当前 fork 的仓库,然后重新 fork 一次。
### 5.2 允许 Fork 代码运行 Workflows
返回到你刚刚 fork 完成的 repo然后点击 Actions 去允许 Workflows 在你的 fork repo 中运行:
![Workflow](assets/enable-workflows-light.png#gh-light-mode-only)
![Workflow](assets/enable-workflows-dark.png#gh-dark-mode-only)
### 5.3 修改 info.json
允许 Workflows 后,进入 `keygen/info.json`,点击编辑按钮,对该文件进行编辑:
![Edit](assets/edit-json-light.png#gh-light-mode-only)
![Edit](assets/edit-json-dark.png#gh-dark-mode-only)
打开该文件,你会发现有以下内容:
```json
{
"text1": "Github",
"text2": "Github.com"
}
```
你可以自己修改 `text1``text2` 相对应的值,例如:
```json
{
"text1": "Your Name",
"text2": "Your License"
}
```
`test1``test2` 参数均是 **ANSI 编码,目前已经支持空格**
修改完成之后,点击 **Commit changes** 按钮Github Actions 会自动开始执行。
### 5.4 下载文件
进入 **Actions** 并选择 **WinRAR Keygen** 页面查看程序运行状况:
![Workflow](assets/push-workflows-light.png#gh-light-mode-only)
![Workflow](assets/push-workflows-dark.png#gh-dark-mode-only)
绿色说明运行成功,黄色说明正在运行,红色说明运行失败。运行成功之后,打开对应的任务,选择 **rarreg_file** 下载:
![Download](assets/file-download-light.png##gh-light-mode-only)
![Download](assets/file-download-dark.png#gh-dark-mode-only)
`rarreg_file.zip` 解压缩后会得到 `rarreg.key`,然后拖动导入 WinRAR 即可。你也可以将 `rarreg.key` 压缩成 `rarkey.rar`,然后双击运行,授权导入将会自动进行。
如果你得到的是 key 是无效的,请查看 [解决方法](#7-无效的-Key)。
</details>
## 6. 通过 Visual Studio 编译使用
## 8. 通过 Visual Studio 编译使用
<details>
<summary>点击展开</summary>
@ -193,7 +200,7 @@ WinRAR 不是免费软件。如果你想使用它,你应当向 [__RARLAB__](ht
如果你不想自行编译,也可以到 [Release](https://github.com/bitcookies/winrar-keygen/releases/) 页面获取对应版本的 `winrar-keygen.exe`
### 6.1 前提条件
### 8.1 前提条件
1. 请确保你有 **Visual Studio 2022**,因为这是一个 VS2022 项目。如果你仍在使用 Visual Studio 2019可以在 [vs2019](https://github.com/bitcookies/winrar-keygen/tree/vs2019) 分支中找到适合 VS2019 的项目,但是此分支将不再维护。
@ -205,18 +212,18 @@ WinRAR 不是免费软件。如果你想使用它,你应当向 [__RARLAB__](ht
你可以通过下的命令来安装:
```console
```shell
$ vcpkg install mpir:x86-windows-static
$ vcpkg install mpir:x64-windows-static
```
3. 你的 `vcpkg`__Visual Studio__ 整合了,即你曾成功运行了下面这条命令:
```console
```shell
$ vcpkg integrate install
```
### 6.2 编译
### 8.2 编译
1. 在 __Visual Studio__ 中打开这个项目;
2. 选择 `Release` 配置;
@ -224,21 +231,20 @@ WinRAR 不是免费软件。如果你想使用它,你应当向 [__RARLAB__](ht
你将在 `bin/` 目录下看到生成的文件。
### 6.3 如何使用?
### 8.3 如何使用?
直接在终端执行以下代码,配置两个参数即可生成 `rarreg.key`
这里以 `Github``Github.com` 为例:
这里以 `Github``Single PC usage license` 用 ASCII 编码为例:
```console
```shell
Usage:
winrar-keygen.exe <Your Name> <Your License>
winrar-keygen.exe <Username> <License Name>
Example:
winrar-keygen.exe "Github" "Github.com"
or:
winrar-keygen.exe "Github" "Github.com" > rarreg.key
winrar-keygen.exe "Github" "Single PC usage license"
or:
winrar-keygen.exe "Github" "Github.com" | Out-File -Encoding ASCII rarreg.key
```
@ -247,65 +253,105 @@ Example:
现在你可以看到新生成的文件:
```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
```
将生成的信息以 **ANSI 编码** 的文本格式保存为 `rarreg.key`
### 8.4 多语言的支持
使用 ANSI 编码时你只能使用你操作系统所在国家或地区的字符。ANSI 编码从 Powershell 7.4 以后开始支持,你还需要[升级你的 Powershell](https://learn.microsoft.com/en-us/powershell/scripting/install/installing-powershell-on-windows?view=powershell-7.4)。
用 ANSI 编码生成多语言的 license
```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
```
使用 UTF-8 编码生成多语言的 license 时,你可能需要在 “控制面板 > 时钟和区域 > 区域 > 管理 > 更改系统区域设置 ” 中勾选使用 “Beta版:使用Unicode UTF-8提供全球语言支持” 才能正确的处理数据。但是不建议你这么操作,这可能会导致很多软件无法正常运行,建议[使用 Github Actions](#6-使用-Github-Actions)。
用 UTF-8 编码生成多语言的 license
> `utf8:` 是为了保证在不同语言的 WinRAR 中做到不变的字符表示。
```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. 无效的 Key
## 9. 无效的 Key
为什么我生成的 `rarreg.key` 是无效的?
### 7.1 ANSI 编码
### 9.1 编码不正确
`test1` 以及 `test2` 生成的许可文本,均是 **ANSI 编码,目前已经支持空格** [Issues #5](https://github.com/bitcookies/winrar-keygen/issues/5)。
参数 `TEXT1``TEXT2` 需要满足[对应的编码要求](#4-编码说明)
```console
winrar-keygen.exe <text1> <text2>
```shell
winrar-keygen.exe <TEXT1> <TEXT2>
```
具体可参考原理文档:[授权文件"rarreg.key"的生成](https://github.com/bitcookies/winrar-keygen/blob/master/README.HOW_DOES_IT_WORK.zh-CN.md#7-%E6%8E%88%E6%9D%83%E6%96%87%E4%BB%B6rarregkey%E7%9A%84%E7%94%9F%E6%88%90)
### 7.2 TXT 编码
### 9.2 文件储存编码
如果你使用了如下命令:
```console
winrar-keygen.exe "Github" "Github.com" > rarreg.key
```shell
winrar-keygen.exe "Github" "Single PC usage license" > rarreg.key
```
在较新的 Windows 10 系统中PowerShell 将默认以 **UTF16-LE** 格式导出,这将会导致错误。
请使用如下命令:
指定输出编码格式,例如
```console
```shell
winrar-keygen.exe "Github" "Github.com" | Out-File -Encoding ASCII rarreg.key
```
### 7.3 Key 的位置
### 9.3 Key 的位置
如果你无法执行拖动操作,你可以尝试把 `rarreg.key` 放在以下目录中:
如果你无法执行拖动操作,你可以尝试把 `rarreg.key`置与以下目录中:
```console
```shell
C:\Users\yourname\AppData\Roaming\WinRAR\rarreg.key
```
你也可以将 `rarreg.key` 压缩成 `rarkey.rar`然后双击运行,授权导入将会自动进行。
你也可以将 `rarreg.key` 压缩成 `rarkey.rar` 然后双击运行,授权导入将会自动进行。
### 7.4 关于简体中文版
### 9.4 关于简体中文版
在 [__RARLAB__](https://www.rarlab.com/) 下载的简体中文版 WinRAR 将会自带广告组件,即使使用了 `rarreg.key` 授权广告组件依旧会出现。这是由于简体中文代理商的一些意见RARLAB 已将简体中文安装包的公开链接更换成了带有广告的简体中文安装包。
@ -330,20 +376,20 @@ https://www.rarlab.com/rar/winrar-x64-611sc.exe
请注意区分上述连接地址,更多方法可以查看 [Issues #14](https://github.com/bitcookies/winrar-keygen/issues/14) 和 [Issues #19](https://github.com/bitcookies/winrar-keygen/issues/19)。
## 8. 贡献
## 10. 贡献
### 8.1 反馈和建议
### 10.1 反馈和建议
如果您遇到了一些问题,可在 [Issues](https://github.com/bitcookies/winrar-keygen/issues) 页面反馈,会有很多热心的开发者及 Github 用户帮助你。
该项目欢迎贡献和建议,您可以在 [Issues](https://github.com/bitcookies/winrar-keygen/issues) 提出建议,或者进行提交拉取请求 😄
### 8.2 感谢
### 10.2 感谢
非常感谢一些热心的开发者,在 [Issues](https://github.com/bitcookies/winrar-keygen/issues) 帮助解答一些问题。
🏆 特别感谢 [@Sonic-The-Hedgehog-LNK1123](https://github.com/Sonic-The-Hedgehog-LNK1123)
## 9. 许可
## 11. 许可
使用 [MIT License](https://github.com/bitcookies/winrar-keygen/blob/master/LICENSE)

View file

@ -1,4 +0,0 @@
{
"text1": "Github",
"text2": "Github.com"
}