Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Complete English translation #17

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 33 additions & 33 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,57 +1,57 @@
# weibo-img-crypto
自动加密解密微博上传的图片
Automatically encrypt and decrypt images uploaded to Weibo

## 如何使用
### 方法 1,适合临时使用
在浏览器地址栏输入以下代码,上传图片时就会自动加密,在图片上点击鼠标右键就会自动解密。注意前面的 "`javascript:`" 必须手动输入,不能复制粘贴,否则会被浏览器自动去掉。执行成功后,点击左下角的北极熊 ~~(天哥哥)~~ 按钮可以打开设置界面
## How to use
### Method 1, suitable for temporary use
Enter the following code in the browser address bar, and the image will be automatically encrypted when it is uploaded. Right-click on the image to automatically decrypt it. Note that the "`javascript:`" in front must be entered manually and cannot be copied and pasted, otherwise it will be automatically removed by the browser. After successful execution, click the polar bear ~~ (brother Tian)~~ button in the lower left corner to open the settings interface

```javascript
javascript:fetch('https://raw.githubusercontent.com/xfgryujk/weibo-img-crypto/master/weibo-img-crypto.js').then(res => res.text(), e => alert('载入失败:' + e)).then(res => {let script = document.createElement('script'); script.innerHTML = res; document.body.appendChild(script)})
javascript:fetch('https://raw.githubusercontent.com/xfgryujk/weibo-img-crypto/master/weibo-img-crypto.js').then(res => res.text(), e => alert('Load failed:' + e)).then(res => {let script = document.createElement('script'); script.innerHTML = res; document.body.appendChild(script)})
```

也可以按 `Ctrl + Shift + J` 打开控制台,在控制台输入。也可以将这些代码作为网址添加到书签/收藏夹,能更快使用
You can also press `Ctrl + Shift + J` to open the console and enter it. You can also add these codes as URLs to your bookmarks/favorites for faster use

### 方法 2,适合长期使用
首先安装 [Tampermonkey](http://tampermonkey.net/) 浏览器扩展,然后[去 Greasy Fork 添加 weibo-img-crypto 脚本](https://greasyfork.org/zh-CN/scripts/370359-weibo-img-crypto)。这样访问微博时会自动执行方法 1 的代码
### Method 2, suitable for long-term use
First install the [Tampermonkey](http://tampermonkey.net/) browser extension, then [go to Greasy Fork to add the weibo-img-crypto script](https://greasyfork.org/zh-CN/scripts/370359-weibo-img-crypto). This will automatically execute the code in method 1 when you visit Weibo

## 算法说明
加密的原理是把像素块或 RGB 数据随机移动到一个新位置,所以加密解密时的随机种子必须一样。默认的随机种子是 `114514`,可以在设置界面修改随机种子
## Algorithm description
The principle of encryption is to randomly move pixel blocks or RGB data to a new position, so the random seed must be the same during encryption and decryption. The default random seed is `114514`, which can be modified in the settings interface

推荐使用`块随机置乱`算法,这样不会出现有损压缩再解密造成的高频噪声。`RGB随机置乱`算法会出现有损压缩再解密造成的高频噪声。至于反色算法~~只是作者平时用来看某些博主的色图用的~~,不算加密
It is recommended to use the `block random scrambling` algorithm, so that high-frequency noise caused by lossy compression and decryption will not appear. The `RGB random scrambling` algorithm will cause high-frequency noise caused by lossy compression and decryption. As for the inverted color algorithm, it is only used by the author to view the color pictures of some bloggers, not encryption.

## 兼容性
目前不支持 GIF 图,以后可能支持
## Compatibility
GIF images are not supported at present, but may be supported in the future

只在 ChromeEdge 浏览器测试过,不保证支持其他浏览器 ~~(IE 是什么?我可不知道)~~
It has only been tested on Chrome and Edge browsers, and support for other browsers is not guaranteed ~~ (What is IE? I don’t know)~~

## 效果
加密后:
## Effect
After encryption:

![加密后](https://github.com/xfgryujk/weibo-img-crypto/blob/master/demo/encrypted.jpg)
![After encryption](https://github.com/xfgryujk/weibo-img-crypto/blob/master/demo/encrypted.jpg)

解密后:
After decryption:

![解密后](https://github.com/xfgryujk/weibo-img-crypto/blob/master/demo/decrypted.png)
![After decryption](https://github.com/xfgryujk/weibo-img-crypto/blob/master/demo/decrypted.png)

原图:
Original image:

![原图](https://github.com/xfgryujk/weibo-img-crypto/blob/master/demo/origin.jpg)
![Original image](https://github.com/xfgryujk/weibo-img-crypto/blob/master/demo/origin.jpg)

## FA♂Q
### 为什么不支持手机端?
目前实在没有找到支持手机端的简单方法,如果有可以告诉我
### Why is it not supported on mobile phones?
At present, there is really no simple method that supports mobile phones. If there is one, please tell me

### 为什么不自己租个服务器放图片?
你出钱我就租
### Why don’t you rent a server to store pictures?
I will rent it if you pay

### 为什么不用傅里叶变换?
因为图片的灰度范围只有 256 个数,而傅里叶变换后的值域非常大,无法表示,更不用说 JPEG 压缩后的损失了
### Why not use Fourier transform?
Because the grayscale range of the picture is only 256 numbers, and the value range after Fourier transform is very large and cannot be represented, not to mention the loss after JPEG compression

### 为什么不用异或?
初版用的就是异或的方法,但是经过 JPEG 压缩后再解密出现了严重的噪点,而且异或后的图片还是能看出轮廓,无法防止被二五仔举报
### Why not use XOR?
The first version used the XOR method, but after JPEG compression and decryption, serious noise appeared, and the outline of the picture after XOR can still be seen, which cannot prevent being reported by traitors

### 为什么不用 AESRSA 等加密?
同上,我觉得保留原始像素数据能尽量减少数据损失,而且加密是怎么乱怎么来,最好不要留原图的轮廓以免被二五仔举报
### Why not use AES, RSA and other encryption?
Same as above, I think retaining the original pixel data can minimize data loss, and encryption is random, it is best not to keep the outline of the original picture to avoid being reported by traitors

### 默认随机种子 114514 是什么意思?
作者的恶趣味,自行百度
### What does the default random seed 114514 mean?
The author’s bad taste, Baidu by yourself
Loading