Merge branch 'py3-latest' into zeronet-enhanced
This commit is contained in:
commit
0aed438ae5
8 changed files with 100 additions and 435 deletions
65
README-ru.md
65
README-ru.md
|
@ -1,9 +1,9 @@
|
||||||
# ZeroNet [](https://travis-ci.org/HelloZeroNet/ZeroNet) [](https://zeronet.io/docs/faq/) [](https://zeronet.io/docs/help_zeronet/donate/)
|
# ZeroNet [](https://github.com/ZeroNetX/ZeroNet/actions/workflows/tests.yml) [](https://docs.zeronet.dev/1DeveLopDZL1cHfKi8UXHh2UBEhzH6HhMp/faq/) [](https://docs.zeronet.dev/1DeveLopDZL1cHfKi8UXHh2UBEhzH6HhMp/help_zeronet/donate/) [](https://hub.docker.com/r/canewsin/zeronet)
|
||||||
|
|
||||||
[简体中文](./README-zh-cn.md)
|
[简体中文](./README-zh-cn.md)
|
||||||
[English](./README.md)
|
[English](./README.md)
|
||||||
|
|
||||||
Децентрализованные вебсайты использующие Bitcoin криптографию и BitTorrent сеть - https://zeronet.io
|
Децентрализованные вебсайты использующие Bitcoin криптографию и BitTorrent сеть - https://zeronet.dev
|
||||||
|
|
||||||
|
|
||||||
## Зачем?
|
## Зачем?
|
||||||
|
@ -45,9 +45,9 @@
|
||||||
(используя подпись), они загружают измененные файлы и публикуют новый контент для других пиров.
|
(используя подпись), они загружают измененные файлы и публикуют новый контент для других пиров.
|
||||||
|
|
||||||
#### [Слайд-шоу о криптографии ZeroNet, обновлениях сайтов, многопользовательских сайтах »](https://docs.google.com/presentation/d/1_2qK1IuOKJ51pgBvllZ9Yu7Au2l551t3XBgyTSvilew/pub?start=false&loop=false&delayms=3000)
|
#### [Слайд-шоу о криптографии ZeroNet, обновлениях сайтов, многопользовательских сайтах »](https://docs.google.com/presentation/d/1_2qK1IuOKJ51pgBvllZ9Yu7Au2l551t3XBgyTSvilew/pub?start=false&loop=false&delayms=3000)
|
||||||
#### [Часто задаваемые вопросы »](https://zeronet.io/docs/faq/)
|
#### [Часто задаваемые вопросы »](https://docs.zeronet.dev/1DeveLopDZL1cHfKi8UXHh2UBEhzH6HhMp/faq/)
|
||||||
|
|
||||||
#### [Документация разработчика ZeroNet »](https://zeronet.io/docs/site_development/getting_started/)
|
#### [Документация разработчика ZeroNet »](https://docs.zeronet.dev/1DeveLopDZL1cHfKi8UXHh2UBEhzH6HhMp/site_development/getting_started/)
|
||||||
|
|
||||||
|
|
||||||
## Скриншоты
|
## Скриншоты
|
||||||
|
@ -55,36 +55,37 @@
|
||||||

|

|
||||||

|

|
||||||
|
|
||||||
#### [Больше скриншотов в ZeroNet документации »](https://zeronet.io/docs/using_zeronet/sample_sites/)
|
#### [Больше скриншотов в ZeroNet документации »](https://docs.zeronet.dev/1DeveLopDZL1cHfKi8UXHh2UBEhzH6HhMp/using_zeronet/sample_sites/)
|
||||||
|
|
||||||
|
|
||||||
## Как вступить
|
## Как вступить
|
||||||
|
|
||||||
* Скачайте ZeroBundle пакет:
|
* Скачайте ZeroBundle пакет:
|
||||||
* [Microsoft Windows](https://github.com/HelloZeroNet/ZeroNet-win/archive/dist/ZeroNet-win.zip)
|
* [Microsoft Windows](https://github.com/ZeroNetX/ZeroNet/releases/latest/download/ZeroNet-win.zip)
|
||||||
* [Apple macOS](https://github.com/HelloZeroNet/ZeroNet-mac/archive/dist/ZeroNet-mac.zip)
|
* [Apple macOS](https://github.com/ZeroNetX/ZeroNet/releases/latest/download/ZeroNet-mac.zip)
|
||||||
* [Linux 64-bit](https://github.com/HelloZeroNet/ZeroBundle/raw/master/dist/ZeroBundle-linux64.tar.gz)
|
* [Linux 64-bit](https://github.com/ZeroNetX/ZeroNet/releases/latest/download/ZeroNet-linux.zip)
|
||||||
* [Linux 32-bit](https://github.com/HelloZeroNet/ZeroBundle/raw/master/dist/ZeroBundle-linux32.tar.gz)
|
* [Linux 32-bit](https://github.com/ZeroNetX/ZeroNet/releases/latest/download/ZeroNet-linux.zip)
|
||||||
* Распакуйте где угодно
|
* Распакуйте где угодно
|
||||||
* Запустите `ZeroNet.exe` (win), `ZeroNet(.app)` (osx), `ZeroNet.sh` (linux)
|
* Запустите `ZeroNet.exe` (win), `ZeroNet(.app)` (osx), `ZeroNet.sh` (linux)
|
||||||
|
|
||||||
### Linux терминал
|
### Linux терминал
|
||||||
|
|
||||||
* `wget https://github.com/HelloZeroNet/ZeroBundle/raw/master/dist/ZeroBundle-linux64.tar.gz`
|
* `wget https://github.com/ZeroNetX/ZeroNet/releases/latest/download/ZeroNet-linux.zip`
|
||||||
* `tar xvpfz ZeroBundle-linux64.tar.gz`
|
* `unzip ZeroNet-linux.zip`
|
||||||
* `cd ZeroBundle`
|
* `cd ZeroNet-linux`
|
||||||
* Запустите с помощью `./ZeroNet.sh`
|
* Запустите с помощью `./ZeroNet.sh`
|
||||||
|
|
||||||
Он загружает последнюю версию ZeroNet, затем запускает её автоматически.
|
Он загружает последнюю версию ZeroNet, затем запускает её автоматически.
|
||||||
|
|
||||||
#### Ручная установка для Debian Linux
|
#### Ручная установка для Debian Linux
|
||||||
|
|
||||||
|
* `wget https://github.com/ZeroNetX/ZeroNet/releases/latest/download/ZeroNet-src.zip`
|
||||||
|
* `unzip ZeroNet-src.zip`
|
||||||
|
* `cd ZeroNet`
|
||||||
* `sudo apt-get update`
|
* `sudo apt-get update`
|
||||||
* `sudo apt-get install msgpack-python python-gevent`
|
* `sudo apt-get install python3-pip`
|
||||||
* `wget https://github.com/HelloZeroNet/ZeroNet/archive/master.tar.gz`
|
* `sudo python3 -m pip install -r requirements.txt`
|
||||||
* `tar xvpfz master.tar.gz`
|
* Запустите с помощью `python3 zeronet.py`
|
||||||
* `cd ZeroNet-master`
|
|
||||||
* Запустите с помощью `python2 zeronet.py`
|
|
||||||
* Откройте http://127.0.0.1:43110/ в вашем браузере.
|
* Откройте http://127.0.0.1:43110/ в вашем браузере.
|
||||||
|
|
||||||
### [Arch Linux](https://www.archlinux.org)
|
### [Arch Linux](https://www.archlinux.org)
|
||||||
|
@ -122,16 +123,16 @@ article](https://wiki.archlinux.org/index.php/ZeroNet) для дальнейше
|
||||||
* `vagrant up`
|
* `vagrant up`
|
||||||
* Подключитесь к VM с помощью `vagrant ssh`
|
* Подключитесь к VM с помощью `vagrant ssh`
|
||||||
* `cd /vagrant`
|
* `cd /vagrant`
|
||||||
* Запустите `python2 zeronet.py --ui_ip 0.0.0.0`
|
* Запустите `python3 zeronet.py --ui_ip 0.0.0.0`
|
||||||
* Откройте http://127.0.0.1:43110/ в вашем браузере.
|
* Откройте http://127.0.0.1:43110/ в вашем браузере.
|
||||||
|
|
||||||
### [Docker](https://www.docker.com/)
|
### [Docker](https://www.docker.com/)
|
||||||
* `docker run -d -v <local_data_folder>:/root/data -p 15441:15441 -p 127.0.0.1:43110:43110 nofish/zeronet`
|
* `docker run -d -v <local_data_folder>:/root/data -p 15441:15441 -p 127.0.0.1:43110:43110 canewsin/zeronet`
|
||||||
* Это изображение Docker включает в себя прокси-сервер Tor, который по умолчанию отключён.
|
* Это изображение Docker включает в себя прокси-сервер Tor, который по умолчанию отключён.
|
||||||
Остерегайтесь что некоторые хостинг-провайдеры могут не позволить вам запускать Tor на своих серверах.
|
Остерегайтесь что некоторые хостинг-провайдеры могут не позволить вам запускать Tor на своих серверах.
|
||||||
Если вы хотите включить его,установите переменную среды `ENABLE_TOR` в` true` (по умолчанию: `false`) Например:
|
Если вы хотите включить его,установите переменную среды `ENABLE_TOR` в` true` (по умолчанию: `false`) Например:
|
||||||
|
|
||||||
`docker run -d -e "ENABLE_TOR=true" -v <local_data_folder>:/root/data -p 15441:15441 -p 127.0.0.1:43110:43110 nofish/zeronet`
|
`docker run -d -e "ENABLE_TOR=true" -v <local_data_folder>:/root/data -p 15441:15441 -p 127.0.0.1:43110:43110 canewsin/zeronet`
|
||||||
* Откройте http://127.0.0.1:43110/ в вашем браузере.
|
* Откройте http://127.0.0.1:43110/ в вашем браузере.
|
||||||
|
|
||||||
### [Virtualenv](https://virtualenv.readthedocs.org/en/latest/)
|
### [Virtualenv](https://virtualenv.readthedocs.org/en/latest/)
|
||||||
|
@ -139,14 +140,12 @@ article](https://wiki.archlinux.org/index.php/ZeroNet) для дальнейше
|
||||||
* `virtualenv env`
|
* `virtualenv env`
|
||||||
* `source env/bin/activate`
|
* `source env/bin/activate`
|
||||||
* `pip install msgpack gevent`
|
* `pip install msgpack gevent`
|
||||||
* `python2 zeronet.py`
|
* `python3 zeronet.py`
|
||||||
* Откройте http://127.0.0.1:43110/ в вашем браузере.
|
* Откройте http://127.0.0.1:43110/ в вашем браузере.
|
||||||
|
|
||||||
## Текущие ограничения
|
## Текущие ограничения
|
||||||
|
|
||||||
* ~~Нет torrent-похожего файла разделения для поддержки больших файлов~~ (поддержка больших файлов добавлена)
|
* Файловые транзакции не сжаты
|
||||||
* ~~Не анонимнее чем Bittorrent~~ (добавлена встроенная поддержка Tor)
|
|
||||||
* Файловые транзакции не сжаты ~~ или незашифрованы еще ~~ (добавлено шифрование TLS)
|
|
||||||
* Нет приватных сайтов
|
* Нет приватных сайтов
|
||||||
|
|
||||||
|
|
||||||
|
@ -168,7 +167,7 @@ $ zeronet.py
|
||||||
Поздравляем, вы закончили! Теперь каждый может получить доступ к вашему зайту используя
|
Поздравляем, вы закончили! Теперь каждый может получить доступ к вашему зайту используя
|
||||||
`http://localhost:43110/13DNDkMUExRf9Xa9ogwPKqp7zyHFEqbhC2`
|
`http://localhost:43110/13DNDkMUExRf9Xa9ogwPKqp7zyHFEqbhC2`
|
||||||
|
|
||||||
Следующие шаги: [ZeroNet Developer Documentation](https://zeronet.io/docs/site_development/getting_started/)
|
Следующие шаги: [ZeroNet Developer Documentation](https://docs.zeronet.dev/1DeveLopDZL1cHfKi8UXHh2UBEhzH6HhMp/site_development/getting_started/)
|
||||||
|
|
||||||
|
|
||||||
## Как я могу модифицировать Zeronet сайт?
|
## Как я могу модифицировать Zeronet сайт?
|
||||||
|
@ -196,16 +195,14 @@ Site:13DNDk..bhC2 Successfuly published to 3 peers
|
||||||
|
|
||||||
|
|
||||||
## Поддержите проект
|
## Поддержите проект
|
||||||
|
- Bitcoin: 1ZeroNetyV5mKY9JF1gsm82TuBXHpfdLX (Preferred)
|
||||||
|
- LiberaPay: https://liberapay.com/PramUkesh
|
||||||
|
- Paypal: https://paypal.me/PramUkesh
|
||||||
|
- Others: [Donate](!https://docs.zeronet.dev/1DeveLopDZL1cHfKi8UXHh2UBEhzH6HhMp/help_zeronet/donate/#help-to-keep-zeronet-development-alive)
|
||||||
|
|
||||||
- Bitcoin: 1QDhxQ6PraUZa21ET5fYUCPgdrwBomnFgX
|
|
||||||
- Paypal: https://zeronet.io/docs/help_zeronet/donate/
|
|
||||||
|
|
||||||
### Спонсоры
|
|
||||||
|
|
||||||
* Улучшенная совместимость с MacOS / Safari стала возможной благодаря [BrowserStack.com](https://www.browserstack.com)
|
|
||||||
|
|
||||||
#### Спасибо!
|
#### Спасибо!
|
||||||
|
|
||||||
* Больше информации, помощь, журнал изменений, zeronet сайты: https://www.reddit.com/r/zeronet/
|
* Больше информации, помощь, журнал изменений, zeronet сайты: https://www.reddit.com/r/zeronetx/
|
||||||
* Приходите, пообщайтесь с нами: [#zeronet @ FreeNode](https://kiwiirc.com/client/irc.freenode.net/zeronet) или на [gitter](https://gitter.im/HelloZeroNet/ZeroNet)
|
* Приходите, пообщайтесь с нами: [#zeronet @ FreeNode](https://kiwiirc.com/client/irc.freenode.net/zeronet) или на [gitter](https://gitter.im/canewsin/ZeroNet)
|
||||||
* Email: hello@zeronet.io (PGP: CB9613AE)
|
* Email: canews.in@gmail.com
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
# ZeroNet [](https://travis-ci.org/HelloZeroNet/ZeroNet) [](https://zeronet.io/docs/faq/) [](https://zeronet.io/docs/help_zeronet/donate/)
|
# ZeroNet [](https://github.com/ZeroNetX/ZeroNet/actions/workflows/tests.yml) [](https://docs.zeronet.dev/1DeveLopDZL1cHfKi8UXHh2UBEhzH6HhMp/faq/) [](https://docs.zeronet.dev/1DeveLopDZL1cHfKi8UXHh2UBEhzH6HhMp/help_zeronet/donate/) [](https://hub.docker.com/r/canewsin/zeronet)
|
||||||
|
|
||||||
[English](./README.md)
|
[English](./README.md)
|
||||||
|
|
||||||
使用 Bitcoin 加密和 BitTorrent 网络的去中心化网络 - https://zeronet.io
|
使用 Bitcoin 加密和 BitTorrent 网络的去中心化网络 - https://zeronet.dev
|
||||||
|
|
||||||
|
|
||||||
## 为什么?
|
## 为什么?
|
||||||
|
@ -41,9 +41,9 @@
|
||||||
那么这些节点将会在使用签名验证 `content.json` 的真实性后,下载修改后的文件并将新内容推送至另外的节点
|
那么这些节点将会在使用签名验证 `content.json` 的真实性后,下载修改后的文件并将新内容推送至另外的节点
|
||||||
|
|
||||||
#### [关于 ZeroNet 加密,站点更新,多用户站点的幻灯片 »](https://docs.google.com/presentation/d/1_2qK1IuOKJ51pgBvllZ9Yu7Au2l551t3XBgyTSvilew/pub?start=false&loop=false&delayms=3000)
|
#### [关于 ZeroNet 加密,站点更新,多用户站点的幻灯片 »](https://docs.google.com/presentation/d/1_2qK1IuOKJ51pgBvllZ9Yu7Au2l551t3XBgyTSvilew/pub?start=false&loop=false&delayms=3000)
|
||||||
#### [常见问题 »](https://zeronet.io/docs/faq/)
|
#### [常见问题 »](https://docs.zeronet.dev/1DeveLopDZL1cHfKi8UXHh2UBEhzH6HhMp/faq/)
|
||||||
|
|
||||||
#### [ZeroNet 开发者文档 »](https://zeronet.io/docs/site_development/getting_started/)
|
#### [ZeroNet 开发者文档 »](https://docs.zeronet.dev/1DeveLopDZL1cHfKi8UXHh2UBEhzH6HhMp/site_development/getting_started/)
|
||||||
|
|
||||||
|
|
||||||
## 屏幕截图
|
## 屏幕截图
|
||||||
|
@ -51,28 +51,28 @@
|
||||||

|

|
||||||

|

|
||||||
|
|
||||||
#### [ZeroNet 文档中的更多屏幕截图 »](https://zeronet.io/docs/using_zeronet/sample_sites/)
|
#### [ZeroNet 文档中的更多屏幕截图 »](https://docs.zeronet.dev/1DeveLopDZL1cHfKi8UXHh2UBEhzH6HhMp/using_zeronet/sample_sites/)
|
||||||
|
|
||||||
|
|
||||||
## 如何加入
|
## 如何加入
|
||||||
|
|
||||||
### Windows
|
### Windows
|
||||||
|
|
||||||
- 下载 [ZeroNet-py3-win64.zip](https://github.com/HelloZeroNet/ZeroNet-win/archive/dist-win64/ZeroNet-py3-win64.zip) (18MB)
|
- 下载 [ZeroNet-win.zip](https://github.com/ZeroNetX/ZeroNet/releases/latest/download/ZeroNet-win.zip) (26MB)
|
||||||
- 在任意位置解压缩
|
- 在任意位置解压缩
|
||||||
- 运行 `ZeroNet.exe`
|
- 运行 `ZeroNet.exe`
|
||||||
|
|
||||||
### macOS
|
### macOS
|
||||||
|
|
||||||
- 下载 [ZeroNet-dist-mac.zip](https://github.com/HelloZeroNet/ZeroNet-dist/archive/mac/ZeroNet-dist-mac.zip) (13.2MB)
|
- 下载 [ZeroNet-mac.zip](https://github.com/ZeroNetX/ZeroNet/releases/latest/download/ZeroNet-mac.zip) (14MB)
|
||||||
- 在任意位置解压缩
|
- 在任意位置解压缩
|
||||||
- 运行 `ZeroNet.app`
|
- 运行 `ZeroNet.app`
|
||||||
|
|
||||||
### Linux (x86-64bit)
|
### Linux (x86-64bit)
|
||||||
|
|
||||||
- `wget https://github.com/HelloZeroNet/ZeroNet-linux/archive/dist-linux64/ZeroNet-py3-linux64.tar.gz`
|
- `wget https://github.com/ZeroNetX/ZeroNet/releases/latest/download/ZeroNet-linux.zip`
|
||||||
- `tar xvpfz ZeroNet-py3-linux64.tar.gz`
|
- `unzip ZeroNet-linux.zip`
|
||||||
- `cd ZeroNet-linux-dist-linux64/`
|
- `cd ZeroNet-linux`
|
||||||
- 使用以下命令启动 `./ZeroNet.sh`
|
- 使用以下命令启动 `./ZeroNet.sh`
|
||||||
- 在浏览器打开 http://127.0.0.1:43110/ 即可访问 ZeroHello 页面
|
- 在浏览器打开 http://127.0.0.1:43110/ 即可访问 ZeroHello 页面
|
||||||
|
|
||||||
|
@ -80,20 +80,31 @@
|
||||||
|
|
||||||
### 从源代码安装
|
### 从源代码安装
|
||||||
|
|
||||||
- `wget https://github.com/HelloZeroNet/ZeroNet/archive/py3/ZeroNet-py3.tar.gz`
|
- `wget https://github.com/ZeroNetX/ZeroNet/releases/latest/download/ZeroNet-src.zip`
|
||||||
- `tar xvpfz ZeroNet-py3.tar.gz`
|
- `unzip ZeroNet-src.zip`
|
||||||
- `cd ZeroNet-py3`
|
- `cd ZeroNet`
|
||||||
- `sudo apt-get update`
|
- `sudo apt-get update`
|
||||||
- `sudo apt-get install python3-pip`
|
- `sudo apt-get install python3-pip`
|
||||||
- `sudo python3 -m pip install -r requirements.txt`
|
- `sudo python3 -m pip install -r requirements.txt`
|
||||||
- 使用以下命令启动 `python3 zeronet.py`
|
- 使用以下命令启动 `python3 zeronet.py`
|
||||||
- 在浏览器打开 http://127.0.0.1:43110/ 即可访问 ZeroHello 页面
|
- 在浏览器打开 http://127.0.0.1:43110/ 即可访问 ZeroHello 页面
|
||||||
|
|
||||||
|
### Android (arm, arm64, x86)
|
||||||
|
- minimum Android version supported 21 (Android 5.0 Lollipop)
|
||||||
|
- [<img src="https://play.google.com/intl/en_us/badges/images/generic/en_badge_web_generic.png"
|
||||||
|
alt="Download from Google Play"
|
||||||
|
height="80">](https://play.google.com/store/apps/details?id=in.canews.zeronetmobile)
|
||||||
|
- APK download: https://github.com/canewsin/zeronet_mobile/releases
|
||||||
|
|
||||||
|
### Android (arm, arm64, x86) Thin Client for Preview Only (Size 1MB)
|
||||||
|
- minimum Android version supported 16 (JellyBean)
|
||||||
|
- [<img src="https://play.google.com/intl/en_us/badges/images/generic/en_badge_web_generic.png"
|
||||||
|
alt="Download from Google Play"
|
||||||
|
height="80">](https://play.google.com/store/apps/details?id=dev.zeronetx.app.lite)
|
||||||
|
|
||||||
## 现有限制
|
## 现有限制
|
||||||
|
|
||||||
* ~~没有类似于 torrent 的文件拆分来支持大文件~~ (已添加大文件支持)
|
* 传输文件时没有压缩
|
||||||
* ~~没有比 BitTorrent 更好的匿名性~~ (已添加内置的完整 Tor 支持)
|
|
||||||
* 传输文件时没有压缩~~和加密~~ (已添加 TLS 支持)
|
|
||||||
* 不支持私有站点
|
* 不支持私有站点
|
||||||
|
|
||||||
|
|
||||||
|
@ -104,20 +115,18 @@
|
||||||
* 您可以在 **data/[您的站点地址]** 目录中找到并修改网站的内容
|
* 您可以在 **data/[您的站点地址]** 目录中找到并修改网站的内容
|
||||||
* 修改后打开您的网站,将右上角的「0」按钮拖到左侧,然后点击底部的**签名**并**发布**按钮
|
* 修改后打开您的网站,将右上角的「0」按钮拖到左侧,然后点击底部的**签名**并**发布**按钮
|
||||||
|
|
||||||
接下来的步骤:[ZeroNet 开发者文档](https://zeronet.io/docs/site_development/getting_started/)
|
接下来的步骤:[ZeroNet 开发者文档](https://docs.zeronet.dev/1DeveLopDZL1cHfKi8UXHh2UBEhzH6HhMp/site_development/getting_started/)
|
||||||
|
|
||||||
## 帮助这个项目
|
## 帮助这个项目
|
||||||
|
- Bitcoin: 1ZeroNetyV5mKY9JF1gsm82TuBXHpfdLX (Preferred)
|
||||||
|
- LiberaPay: https://liberapay.com/PramUkesh
|
||||||
|
- Paypal: https://paypal.me/PramUkesh
|
||||||
|
- Others: [Donate](!https://docs.zeronet.dev/1DeveLopDZL1cHfKi8UXHh2UBEhzH6HhMp/help_zeronet/donate/#help-to-keep-zeronet-development-alive)
|
||||||
|
|
||||||
- Bitcoin: 1QDhxQ6PraUZa21ET5fYUCPgdrwBomnFgX
|
|
||||||
- Paypal: https://zeronet.io/docs/help_zeronet/donate/
|
|
||||||
|
|
||||||
### 赞助商
|
|
||||||
|
|
||||||
* [BrowserStack.com](https://www.browserstack.com) 使更好的 macOS/Safari 兼容性成为可能
|
|
||||||
|
|
||||||
#### 感谢您!
|
#### 感谢您!
|
||||||
|
|
||||||
* 更多信息,帮助,变更记录和 zeronet 站点:https://www.reddit.com/r/zeronet/
|
* 更多信息,帮助,变更记录和 zeronet 站点:https://www.reddit.com/r/zeronetx/
|
||||||
* 前往 [#zeronet @ FreeNode](https://kiwiirc.com/client/irc.freenode.net/zeronet) 或 [gitter](https://gitter.im/HelloZeroNet/ZeroNet) 和我们聊天
|
* 前往 [#zeronet @ FreeNode](https://kiwiirc.com/client/irc.freenode.net/zeronet) 或 [gitter](https://gitter.im/canewsin/ZeroNet) 和我们聊天
|
||||||
* [这里](https://gitter.im/ZeroNet-zh/Lobby)是一个 gitter 上的中文聊天室
|
* [这里](https://gitter.im/canewsin/ZeroNet)是一个 gitter 上的中文聊天室
|
||||||
* Email: hello@zeronet.io (PGP: [960F FF2D 6C14 5AA6 13E8 491B 5B63 BAE6 CB96 13AE](https://zeronet.io/files/tamas@zeronet.io_pub.asc))
|
* Email: canews.in@gmail.com
|
||||||
|
|
59
README.md
59
README.md
|
@ -1,7 +1,7 @@
|
||||||
# ZeroNet [](https://github.com/canewsin/ZeroNet/actions/workflows/tests.yml) [](https://zeronet.io/docs/faq/) [](https://zeronet.io/docs/help_zeronet/donate/) [](https://hub.docker.com/r/canewsin/zeronet)
|
# ZeroNet [](https://github.com/ZeroNetX/ZeroNet/actions/workflows/tests.yml) [](https://docs.zeronet.dev/1DeveLopDZL1cHfKi8UXHh2UBEhzH6HhMp/faq/) [](https://docs.zeronet.dev/1DeveLopDZL1cHfKi8UXHh2UBEhzH6HhMp/help_zeronet/donate/) [](https://hub.docker.com/r/canewsin/zeronet)
|
||||||
|
|
||||||
<!--TODO: Update Onion Site -->
|
<!--TODO: Update Onion Site -->
|
||||||
Decentralized websites using Bitcoin crypto and the BitTorrent network - https://zeronet.dev / [onion](http://zeronet34m3r5ngdu54uj57dcafpgdjhxsgq5kla5con4qvcmfzpvhad.onion)
|
Decentralized websites using Bitcoin crypto and the BitTorrent network - https://zeronet.dev / [ZeroNet Site](http://127.0.0.1:43110/1ZeroNetyV5mKY9JF1gsm82TuBXHpfdLX/), Unlike Bitcoin, ZeroNet Doesn't need a blockchain to run, But uses cryptography used by BTC, to ensure data integrity and validation.
|
||||||
|
|
||||||
|
|
||||||
## Why?
|
## Why?
|
||||||
|
@ -41,15 +41,15 @@ Decentralized websites using Bitcoin crypto and the BitTorrent network - https:/
|
||||||
* Every site contains a `content.json` file which holds all other files in a sha512 hash
|
* Every site contains a `content.json` file which holds all other files in a sha512 hash
|
||||||
and a signature generated using the site's private key.
|
and a signature generated using the site's private key.
|
||||||
* If the site owner (who has the private key for the site address) modifies the
|
* If the site owner (who has the private key for the site address) modifies the
|
||||||
site, then he/she signs the new `content.json` and publishes it to the peers.
|
site and signs the new `content.json` and publishes it to the peers.
|
||||||
Afterwards, the peers verify the `content.json` integrity (using the
|
Afterwards, the peers verify the `content.json` integrity (using the
|
||||||
signature), they download the modified files and publish the new content to
|
signature), they download the modified files and publish the new content to
|
||||||
other peers.
|
other peers.
|
||||||
|
|
||||||
#### [Slideshow about ZeroNet cryptography, site updates, multi-user sites »](https://docs.google.com/presentation/d/1_2qK1IuOKJ51pgBvllZ9Yu7Au2l551t3XBgyTSvilew/pub?start=false&loop=false&delayms=3000)
|
#### [Slideshow about ZeroNet cryptography, site updates, multi-user sites »](https://docs.google.com/presentation/d/1_2qK1IuOKJ51pgBvllZ9Yu7Au2l551t3XBgyTSvilew/pub?start=false&loop=false&delayms=3000)
|
||||||
#### [Frequently asked questions »](https://zeronet.io/docs/faq/)
|
#### [Frequently asked questions »](https://docs.zeronet.dev/1DeveLopDZL1cHfKi8UXHh2UBEhzH6HhMp/faq/)
|
||||||
|
|
||||||
#### [ZeroNet Developer Documentation »](https://zeronet.io/docs/site_development/getting_started/)
|
#### [ZeroNet Developer Documentation »](https://docs.zeronet.dev/1DeveLopDZL1cHfKi8UXHh2UBEhzH6HhMp/site_development/getting_started/)
|
||||||
|
|
||||||
|
|
||||||
## Screenshots
|
## Screenshots
|
||||||
|
@ -57,48 +57,54 @@ Decentralized websites using Bitcoin crypto and the BitTorrent network - https:/
|
||||||

|

|
||||||

|

|
||||||
|
|
||||||
#### [More screenshots in ZeroNet docs »](https://zeronet.io/docs/using_zeronet/sample_sites/)
|
#### [More screenshots in ZeroNet docs »](https://docs.zeronet.dev/1DeveLopDZL1cHfKi8UXHh2UBEhzH6HhMp/using_zeronet/sample_sites/)
|
||||||
|
|
||||||
|
|
||||||
## How to join
|
## How to join
|
||||||
|
|
||||||
### Windows
|
### Windows
|
||||||
|
|
||||||
- Download [ZeroNet-py3-win64.zip](https://github.com/ZeroNetX/ZeroNet-win/archive/dist-win64/ZeroNet-py3-win64.zip) (18MB)
|
- Download [ZeroNet-win.zip](https://github.com/ZeroNetX/ZeroNet/releases/latest/download/ZeroNet-win.zip) (26MB)
|
||||||
- Unpack anywhere
|
- Unpack anywhere
|
||||||
- Run `ZeroNet.exe`
|
- Run `ZeroNet.exe`
|
||||||
|
|
||||||
### macOS
|
### macOS
|
||||||
|
|
||||||
- Download [ZeroNet-dist-mac.zip](https://github.com/ZeroNetX/ZeroNet-dist/archive/mac/ZeroNet-dist-mac.zip) (13.2MB)
|
- Download [ZeroNet-mac.zip](https://github.com/ZeroNetX/ZeroNet/releases/latest/download/ZeroNet-mac.zip) (14MB)
|
||||||
- Unpack anywhere
|
- Unpack anywhere
|
||||||
- Run `ZeroNet.app`
|
- Run `ZeroNet.app`
|
||||||
|
|
||||||
### Linux (x86-64bit)
|
### Linux (x86-64bit)
|
||||||
- `wget https://github.com/ZeroNetX/ZeroNet-linux/archive/dist-linux64/ZeroNet-py3-linux64.tar.gz`
|
- `wget https://github.com/ZeroNetX/ZeroNet/releases/latest/download/ZeroNet-linux.zip`
|
||||||
- `tar xvpfz ZeroNet-py3-linux64.tar.gz`
|
- `unzip ZeroNet-linux.zip`
|
||||||
- `cd ZeroNet-linux-dist-linux64/`
|
- `cd ZeroNet-linux`
|
||||||
- Start with: `./ZeroNet.sh`
|
- Start with: `./ZeroNet.sh`
|
||||||
- Open the ZeroHello landing page in your browser by navigating to: http://127.0.0.1:43110/
|
- Open the ZeroHello landing page in your browser by navigating to: http://127.0.0.1:43110/
|
||||||
|
|
||||||
__Tip:__ Start with `./ZeroNet.sh --ui_ip '*' --ui_restrict your.ip.address` to allow remote connections on the web interface.
|
__Tip:__ Start with `./ZeroNet.sh --ui_ip '*' --ui_restrict your.ip.address` to allow remote connections on the web interface.
|
||||||
|
|
||||||
### Android (arm, arm64, x86)
|
### Android (arm, arm64, x86)
|
||||||
- minimum Android version supported 16 (JellyBean)
|
- minimum Android version supported 21 (Android 5.0 Lollipop)
|
||||||
- [<img src="https://play.google.com/intl/en_us/badges/images/generic/en_badge_web_generic.png"
|
- [<img src="https://play.google.com/intl/en_us/badges/images/generic/en_badge_web_generic.png"
|
||||||
alt="Download from Google Play"
|
alt="Download from Google Play"
|
||||||
height="80">](https://play.google.com/store/apps/details?id=in.canews.zeronetmobile)
|
height="80">](https://play.google.com/store/apps/details?id=in.canews.zeronetmobile)
|
||||||
- APK download: https://github.com/canewsin/zeronet_mobile/releases
|
- APK download: https://github.com/canewsin/zeronet_mobile/releases
|
||||||
- XDA Labs: https://labs.xda-developers.com/store/app/in.canews.zeronet
|
|
||||||
|
### Android (arm, arm64, x86) Thin Client for Preview Only (Size 1MB)
|
||||||
|
- minimum Android version supported 16 (JellyBean)
|
||||||
|
- [<img src="https://play.google.com/intl/en_us/badges/images/generic/en_badge_web_generic.png"
|
||||||
|
alt="Download from Google Play"
|
||||||
|
height="80">](https://play.google.com/store/apps/details?id=dev.zeronetx.app.lite)
|
||||||
|
|
||||||
|
|
||||||
#### Docker
|
#### Docker
|
||||||
There is an official image, built from source at: https://hub.docker.com/r/canewsin/zeronet/
|
There is an official image, built from source at: https://hub.docker.com/r/canewsin/zeronet/
|
||||||
|
|
||||||
### Install from source
|
### Install from source
|
||||||
|
|
||||||
- `wget https://github.com/HelloZeroNet/ZeroNet/archive/py3/ZeroNet-py3.tar.gz`
|
- `wget https://github.com/ZeroNetX/ZeroNet/releases/latest/download/ZeroNet-src.zip`
|
||||||
- `tar xvpfz ZeroNet-py3.tar.gz`
|
- `unzip ZeroNet-src.zip`
|
||||||
- `cd ZeroNet-py3`
|
- `cd ZeroNet`
|
||||||
- `sudo apt-get update`
|
- `sudo apt-get update`
|
||||||
- `sudo apt-get install python3-pip`
|
- `sudo apt-get install python3-pip`
|
||||||
- `sudo python3 -m pip install -r requirements.txt`
|
- `sudo python3 -m pip install -r requirements.txt`
|
||||||
|
@ -107,9 +113,7 @@ There is an official image, built from source at: https://hub.docker.com/r/canew
|
||||||
|
|
||||||
## Current limitations
|
## Current limitations
|
||||||
|
|
||||||
* ~~No torrent-like file splitting for big file support~~ (big file support added)
|
* File transactions are not compressed
|
||||||
* ~~No more anonymous than Bittorrent~~ (built-in full Tor support added)
|
|
||||||
* File transactions are not compressed ~~or encrypted yet~~ (TLS encryption added)
|
|
||||||
* No private sites
|
* No private sites
|
||||||
|
|
||||||
|
|
||||||
|
@ -120,19 +124,16 @@ There is an official image, built from source at: https://hub.docker.com/r/canew
|
||||||
* You can find and modify your site's content in **data/[yoursiteaddress]** directory
|
* You can find and modify your site's content in **data/[yoursiteaddress]** directory
|
||||||
* After the modifications open your site, drag the topright "0" button to left, then press **sign** and **publish** buttons on the bottom
|
* After the modifications open your site, drag the topright "0" button to left, then press **sign** and **publish** buttons on the bottom
|
||||||
|
|
||||||
Next steps: [ZeroNet Developer Documentation](https://zeronet.io/docs/site_development/getting_started/)
|
Next steps: [ZeroNet Developer Documentation](https://docs.zeronet.dev/1DeveLopDZL1cHfKi8UXHh2UBEhzH6HhMp/site_development/getting_started/)
|
||||||
|
|
||||||
## Help keep this project alive
|
## Help keep this project alive
|
||||||
|
- Bitcoin: 1ZeroNetyV5mKY9JF1gsm82TuBXHpfdLX (Preferred)
|
||||||
- Bitcoin: 1ZeroNetyV5mKY9JF1gsm82TuBXHpfdLX
|
- LiberaPay: https://liberapay.com/PramUkesh
|
||||||
- Paypal: https://zeronet.io/docs/help_zeronet/donate/
|
- Paypal: https://paypal.me/PramUkesh
|
||||||
|
- Others: [Donate](!https://docs.zeronet.dev/1DeveLopDZL1cHfKi8UXHh2UBEhzH6HhMp/help_zeronet/donate/#help-to-keep-zeronet-development-alive)
|
||||||
### Sponsors
|
|
||||||
|
|
||||||
* Better macOS/Safari compatibility made possible by [BrowserStack.com](https://www.browserstack.com)
|
|
||||||
|
|
||||||
#### Thank you!
|
#### Thank you!
|
||||||
|
|
||||||
* More info, help, changelog, zeronet sites: https://www.reddit.com/r/zeronet/
|
* More info, help, changelog, zeronet sites: https://www.reddit.com/r/zeronetx/
|
||||||
* Come, chat with us: [#zeronet @ FreeNode](https://kiwiirc.com/client/irc.freenode.net/zeronet) or on [gitter](https://gitter.im/canewsin/ZeroNet)
|
* Come, chat with us: [#zeronet @ FreeNode](https://kiwiirc.com/client/irc.freenode.net/zeronet) or on [gitter](https://gitter.im/canewsin/ZeroNet)
|
||||||
* Email: canews.in@gmail.com
|
* Email: canews.in@gmail.com
|
||||||
|
|
1
plugins
1
plugins
|
@ -1 +0,0 @@
|
||||||
Subproject commit 585d1c91bdda4aa92d057b396c38895a3644ccce
|
|
|
@ -13,8 +13,8 @@ import time
|
||||||
class Config(object):
|
class Config(object):
|
||||||
|
|
||||||
def __init__(self, argv):
|
def __init__(self, argv):
|
||||||
self.version = "0.7.6-internal 2"
|
self.version = "0.7.6"
|
||||||
self.rev = 4560
|
self.rev = 4565
|
||||||
self.argv = argv
|
self.argv = argv
|
||||||
self.action = None
|
self.action = None
|
||||||
self.test_parser = None
|
self.test_parser = None
|
||||||
|
|
|
@ -1,340 +0,0 @@
|
||||||
## ZeroNet onion V3 support
|
|
||||||
## The following copied code is copied from stem.util.ed25519 official Tor Project python3 lib
|
|
||||||
## url : https://gitweb.torproject.org/stem.git/tree/stem/util/ed25519.py
|
|
||||||
## the ##modified tag means that the function has been modified respect to the one used by stem lib
|
|
||||||
## the ##custom tag means that the function has been added by me and it's not present on the stem ed25519.py file
|
|
||||||
## every comment i make begins with ##
|
|
||||||
##
|
|
||||||
# The following is copied from...
|
|
||||||
#
|
|
||||||
# https://github.com/pyca/ed25519
|
|
||||||
#
|
|
||||||
# This is under the CC0 license. For more information please see...
|
|
||||||
#
|
|
||||||
# https://github.com/pyca/cryptography/issues/5068
|
|
||||||
|
|
||||||
# ed25519.py - Optimized version of the reference implementation of Ed25519
|
|
||||||
#
|
|
||||||
# Written in 2011? by Daniel J. Bernstein <djb@cr.yp.to>
|
|
||||||
# 2013 by Donald Stufft <donald@stufft.io>
|
|
||||||
# 2013 by Alex Gaynor <alex.gaynor@gmail.com>
|
|
||||||
# 2013 by Greg Price <price@mit.edu>
|
|
||||||
#
|
|
||||||
# To the extent possible under law, the author(s) have dedicated all copyright
|
|
||||||
# and related and neighboring rights to this software to the public domain
|
|
||||||
# worldwide. This software is distributed without any warranty.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the CC0 Public Domain Dedication along
|
|
||||||
# with this software. If not, see
|
|
||||||
# <http://creativecommons.org/publicdomain/zero/1.0/>.
|
|
||||||
|
|
||||||
"""
|
|
||||||
NB: This code is not safe for use with secret keys or secret data.
|
|
||||||
The only safe use of this code is for verifying signatures on public messages.
|
|
||||||
|
|
||||||
Functions for computing the public key of a secret key and for signing
|
|
||||||
a message are included, namely publickey_unsafe and signature_unsafe,
|
|
||||||
for testing purposes only.
|
|
||||||
|
|
||||||
The root of the problem is that Python's long-integer arithmetic is
|
|
||||||
not designed for use in cryptography. Specifically, it may take more
|
|
||||||
or less time to execute an operation depending on the values of the
|
|
||||||
inputs, and its memory access patterns may also depend on the inputs.
|
|
||||||
This opens it to timing and cache side-channel attacks which can
|
|
||||||
disclose data to an attacker. We rely on Python's long-integer
|
|
||||||
arithmetic, so we cannot handle secrets without risking their disclosure.
|
|
||||||
"""
|
|
||||||
|
|
||||||
import hashlib
|
|
||||||
import operator
|
|
||||||
import sys
|
|
||||||
import base64
|
|
||||||
|
|
||||||
|
|
||||||
__version__ = "1.0.dev0"
|
|
||||||
|
|
||||||
|
|
||||||
# Useful for very coarse version differentiation.
|
|
||||||
PY3 = sys.version_info[0] == 3
|
|
||||||
|
|
||||||
if PY3:
|
|
||||||
indexbytes = operator.getitem
|
|
||||||
intlist2bytes = bytes
|
|
||||||
int2byte = operator.methodcaller("to_bytes", 1, "big")
|
|
||||||
else:
|
|
||||||
int2byte = chr
|
|
||||||
range = xrange
|
|
||||||
|
|
||||||
def indexbytes(buf, i):
|
|
||||||
return ord(buf[i])
|
|
||||||
|
|
||||||
def intlist2bytes(l):
|
|
||||||
return b"".join(chr(c) for c in l)
|
|
||||||
|
|
||||||
|
|
||||||
b = 256
|
|
||||||
q = 2 ** 255 - 19
|
|
||||||
l = 2 ** 252 + 27742317777372353535851937790883648493
|
|
||||||
|
|
||||||
|
|
||||||
def H(m):
|
|
||||||
return hashlib.sha512(m).digest()
|
|
||||||
|
|
||||||
|
|
||||||
def pow2(x, p):
|
|
||||||
"""== pow(x, 2**p, q)"""
|
|
||||||
while p > 0:
|
|
||||||
x = x * x % q
|
|
||||||
p -= 1
|
|
||||||
return x
|
|
||||||
|
|
||||||
|
|
||||||
def inv(z):
|
|
||||||
"""$= z^{-1} \mod q$, for z != 0"""
|
|
||||||
# Adapted from curve25519_athlon.c in djb's Curve25519.
|
|
||||||
z2 = z * z % q # 2
|
|
||||||
z9 = pow2(z2, 2) * z % q # 9
|
|
||||||
z11 = z9 * z2 % q # 11
|
|
||||||
z2_5_0 = (z11 * z11) % q * z9 % q # 31 == 2^5 - 2^0
|
|
||||||
z2_10_0 = pow2(z2_5_0, 5) * z2_5_0 % q # 2^10 - 2^0
|
|
||||||
z2_20_0 = pow2(z2_10_0, 10) * z2_10_0 % q # ...
|
|
||||||
z2_40_0 = pow2(z2_20_0, 20) * z2_20_0 % q
|
|
||||||
z2_50_0 = pow2(z2_40_0, 10) * z2_10_0 % q
|
|
||||||
z2_100_0 = pow2(z2_50_0, 50) * z2_50_0 % q
|
|
||||||
z2_200_0 = pow2(z2_100_0, 100) * z2_100_0 % q
|
|
||||||
z2_250_0 = pow2(z2_200_0, 50) * z2_50_0 % q # 2^250 - 2^0
|
|
||||||
return pow2(z2_250_0, 5) * z11 % q # 2^255 - 2^5 + 11 = q - 2
|
|
||||||
|
|
||||||
|
|
||||||
d = -121665 * inv(121666) % q
|
|
||||||
I = pow(2, (q - 1) // 4, q)
|
|
||||||
|
|
||||||
|
|
||||||
def xrecover(y):
|
|
||||||
xx = (y * y - 1) * inv(d * y * y + 1)
|
|
||||||
x = pow(xx, (q + 3) // 8, q)
|
|
||||||
|
|
||||||
if (x * x - xx) % q != 0:
|
|
||||||
x = (x * I) % q
|
|
||||||
|
|
||||||
if x % 2 != 0:
|
|
||||||
x = q-x
|
|
||||||
|
|
||||||
return x
|
|
||||||
|
|
||||||
|
|
||||||
By = 4 * inv(5)
|
|
||||||
Bx = xrecover(By)
|
|
||||||
B = (Bx % q, By % q, 1, (Bx * By) % q)
|
|
||||||
ident = (0, 1, 1, 0)
|
|
||||||
|
|
||||||
|
|
||||||
def edwards_add(P, Q):
|
|
||||||
# This is formula sequence 'addition-add-2008-hwcd-3' from
|
|
||||||
# http://www.hyperelliptic.org/EFD/g1p/auto-twisted-extended-1.html
|
|
||||||
(x1, y1, z1, t1) = P
|
|
||||||
(x2, y2, z2, t2) = Q
|
|
||||||
|
|
||||||
a = (y1-x1)*(y2-x2) % q
|
|
||||||
b = (y1+x1)*(y2+x2) % q
|
|
||||||
c = t1*2*d*t2 % q
|
|
||||||
dd = z1*2*z2 % q
|
|
||||||
e = b - a
|
|
||||||
f = dd - c
|
|
||||||
g = dd + c
|
|
||||||
h = b + a
|
|
||||||
x3 = e*f
|
|
||||||
y3 = g*h
|
|
||||||
t3 = e*h
|
|
||||||
z3 = f*g
|
|
||||||
|
|
||||||
return (x3 % q, y3 % q, z3 % q, t3 % q)
|
|
||||||
|
|
||||||
|
|
||||||
def edwards_double(P):
|
|
||||||
# This is formula sequence 'dbl-2008-hwcd' from
|
|
||||||
# http://www.hyperelliptic.org/EFD/g1p/auto-twisted-extended-1.html
|
|
||||||
(x1, y1, z1, t1) = P
|
|
||||||
|
|
||||||
a = x1*x1 % q
|
|
||||||
b = y1*y1 % q
|
|
||||||
c = 2*z1*z1 % q
|
|
||||||
# dd = -a
|
|
||||||
e = ((x1+y1)*(x1+y1) - a - b) % q
|
|
||||||
g = -a + b # dd + b
|
|
||||||
f = g - c
|
|
||||||
h = -a - b # dd - b
|
|
||||||
x3 = e*f
|
|
||||||
y3 = g*h
|
|
||||||
t3 = e*h
|
|
||||||
z3 = f*g
|
|
||||||
|
|
||||||
return (x3 % q, y3 % q, z3 % q, t3 % q)
|
|
||||||
|
|
||||||
|
|
||||||
def scalarmult(P, e):
|
|
||||||
if e == 0:
|
|
||||||
return ident
|
|
||||||
Q = scalarmult(P, e // 2)
|
|
||||||
Q = edwards_double(Q)
|
|
||||||
if e & 1:
|
|
||||||
Q = edwards_add(Q, P)
|
|
||||||
return Q
|
|
||||||
|
|
||||||
|
|
||||||
# Bpow[i] == scalarmult(B, 2**i)
|
|
||||||
Bpow = []
|
|
||||||
|
|
||||||
|
|
||||||
def make_Bpow():
|
|
||||||
P = B
|
|
||||||
for i in range(253):
|
|
||||||
Bpow.append(P)
|
|
||||||
P = edwards_double(P)
|
|
||||||
make_Bpow()
|
|
||||||
|
|
||||||
|
|
||||||
def scalarmult_B(e):
|
|
||||||
"""
|
|
||||||
Implements scalarmult(B, e) more efficiently.
|
|
||||||
"""
|
|
||||||
# scalarmult(B, l) is the identity
|
|
||||||
e = e % l
|
|
||||||
P = ident
|
|
||||||
for i in range(253):
|
|
||||||
if e & 1:
|
|
||||||
P = edwards_add(P, Bpow[i])
|
|
||||||
e = e // 2
|
|
||||||
assert e == 0, e
|
|
||||||
return P
|
|
||||||
|
|
||||||
|
|
||||||
def encodeint(y):
|
|
||||||
bits = [(y >> i) & 1 for i in range(b)]
|
|
||||||
return b''.join([
|
|
||||||
int2byte(sum([bits[i * 8 + j] << j for j in range(8)]))
|
|
||||||
for i in range(b//8)
|
|
||||||
])
|
|
||||||
|
|
||||||
|
|
||||||
def encodepoint(P):
|
|
||||||
(x, y, z, t) = P
|
|
||||||
zi = inv(z)
|
|
||||||
x = (x * zi) % q
|
|
||||||
y = (y * zi) % q
|
|
||||||
bits = [(y >> i) & 1 for i in range(b - 1)] + [x & 1]
|
|
||||||
return b''.join([
|
|
||||||
int2byte(sum([bits[i * 8 + j] << j for j in range(8)]))
|
|
||||||
for i in range(b // 8)
|
|
||||||
])
|
|
||||||
|
|
||||||
|
|
||||||
def bit(h, i):
|
|
||||||
return (indexbytes(h, i // 8) >> (i % 8)) & 1
|
|
||||||
|
|
||||||
##modified
|
|
||||||
def publickey_unsafe(sk):
|
|
||||||
"""
|
|
||||||
Not safe to use with secret keys or secret data.
|
|
||||||
|
|
||||||
See module docstring. This function should be used for testing only.
|
|
||||||
"""
|
|
||||||
##h = H(sk)
|
|
||||||
h = sk
|
|
||||||
a = 2 ** (b - 2) + sum(2 ** i * bit(h, i) for i in range(3, b - 2))
|
|
||||||
A = scalarmult_B(a)
|
|
||||||
return encodepoint(A)
|
|
||||||
|
|
||||||
##custom
|
|
||||||
## from stem.util.str_tools._to_unicode_impl
|
|
||||||
## from https://gitweb.torproject.org/stem.git/tree/stem/util/str_tools.py#n80
|
|
||||||
def to_unicode_impl(msg):
|
|
||||||
if msg is not None and not isinstance(msg, str):
|
|
||||||
return msg.decode('utf-8', 'replace')
|
|
||||||
else:
|
|
||||||
return msg
|
|
||||||
|
|
||||||
##custom
|
|
||||||
## rewritten stem.descriptor.hidden_service.address_from_identity_key
|
|
||||||
## from https://gitweb.torproject.org/stem.git/tree/stem/descriptor/hidden_service.py#n1088
|
|
||||||
def publickey_to_onionaddress(key):
|
|
||||||
CHECKSUM_CONSTANT = b'.onion checksum'
|
|
||||||
## version = stem.client.datatype.Size.CHAR.pack(3)
|
|
||||||
version = b'\x03'
|
|
||||||
checksum = hashlib.sha3_256(CHECKSUM_CONSTANT + key + version).digest()[:2]
|
|
||||||
onion_address = base64.b32encode(key + checksum + version)
|
|
||||||
return to_unicode_impl(onion_address + b'.onion').lower()
|
|
||||||
|
|
||||||
|
|
||||||
def Hint(m):
|
|
||||||
h = H(m)
|
|
||||||
return sum(2 ** i * bit(h, i) for i in range(2 * b))
|
|
||||||
|
|
||||||
##modified
|
|
||||||
def signature_unsafe(m, sk, pk):
|
|
||||||
"""
|
|
||||||
Not safe to use with secret keys or secret data.
|
|
||||||
|
|
||||||
See module docstring. This function should be used for testing only.
|
|
||||||
"""
|
|
||||||
##h = H(sk)
|
|
||||||
h = sk
|
|
||||||
a = 2 ** (b - 2) + sum(2 ** i * bit(h, i) for i in range(3, b - 2))
|
|
||||||
r = Hint(
|
|
||||||
intlist2bytes([indexbytes(h, j) for j in range(b // 8, b // 4)]) + m
|
|
||||||
)
|
|
||||||
R = scalarmult_B(r)
|
|
||||||
S = (r + Hint(encodepoint(R) + pk + m) * a) % l
|
|
||||||
return encodepoint(R) + encodeint(S)
|
|
||||||
|
|
||||||
|
|
||||||
def isoncurve(P):
|
|
||||||
(x, y, z, t) = P
|
|
||||||
return (z % q != 0 and
|
|
||||||
x*y % q == z*t % q and
|
|
||||||
(y*y - x*x - z*z - d*t*t) % q == 0)
|
|
||||||
|
|
||||||
|
|
||||||
def decodeint(s):
|
|
||||||
return sum(2 ** i * bit(s, i) for i in range(0, b))
|
|
||||||
|
|
||||||
|
|
||||||
def decodepoint(s):
|
|
||||||
y = sum(2 ** i * bit(s, i) for i in range(0, b - 1))
|
|
||||||
x = xrecover(y)
|
|
||||||
if x & 1 != bit(s, b-1):
|
|
||||||
x = q - x
|
|
||||||
P = (x, y, 1, (x*y) % q)
|
|
||||||
if not isoncurve(P):
|
|
||||||
raise ValueError("decoding point that is not on curve")
|
|
||||||
return P
|
|
||||||
|
|
||||||
|
|
||||||
class SignatureMismatch(Exception):
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
def checkvalid(s, m, pk):
|
|
||||||
"""
|
|
||||||
Not safe to use when any argument is secret.
|
|
||||||
|
|
||||||
See module docstring. This function should be used only for
|
|
||||||
verifying public signatures of public messages.
|
|
||||||
"""
|
|
||||||
if len(s) != b // 4:
|
|
||||||
raise ValueError("signature length is wrong")
|
|
||||||
|
|
||||||
if len(pk) != b // 8:
|
|
||||||
raise ValueError("public-key length is wrong")
|
|
||||||
|
|
||||||
R = decodepoint(s[:b // 8])
|
|
||||||
A = decodepoint(pk)
|
|
||||||
S = decodeint(s[b // 8:b // 4])
|
|
||||||
h = Hint(encodepoint(R) + pk + m)
|
|
||||||
|
|
||||||
(x1, y1, z1, t1) = P = scalarmult_B(S)
|
|
||||||
(x2, y2, z2, t2) = Q = edwards_add(R, scalarmult(A, h))
|
|
||||||
|
|
||||||
if (not isoncurve(P) or not isoncurve(Q) or
|
|
||||||
(x1*z2 - x2*z1) % q != 0 or (y1*z2 - y2*z1) % q != 0):
|
|
||||||
raise SignatureMismatch("signature does not pass verification")
|
|
|
@ -52,7 +52,6 @@ def verify(data, publickey, sign):
|
||||||
return valid
|
return valid
|
||||||
|
|
||||||
def privatekeyToPublickey(privatekey):
|
def privatekeyToPublickey(privatekey):
|
||||||
from Crypt import CryptEd25519
|
|
||||||
import rsa
|
import rsa
|
||||||
from rsa import pkcs1
|
from rsa import pkcs1
|
||||||
from lib import Ed25519
|
from lib import Ed25519
|
||||||
|
|
|
@ -165,7 +165,7 @@ class FileRequest(object):
|
||||||
peer = site.addPeer(self.connection.ip, self.connection.port, return_peer=True, source="update") # Add or get peer
|
peer = site.addPeer(self.connection.ip, self.connection.port, return_peer=True, source="update") # Add or get peer
|
||||||
# On complete publish to other peers
|
# On complete publish to other peers
|
||||||
diffs = params.get("diffs", {})
|
diffs = params.get("diffs", {})
|
||||||
site.onComplete.once(lambda: site.publish(inner_path=inner_path, diffs=diffs), "publish_%s" % inner_path)
|
site.onComplete.once(lambda: site.publish(inner_path=inner_path, diffs=diffs, limit=6), "publish_%s" % inner_path)
|
||||||
|
|
||||||
# Load new content file and download changed files in new thread
|
# Load new content file and download changed files in new thread
|
||||||
def downloader():
|
def downloader():
|
||||||
|
|
Loading…
Reference in a new issue