在本文中,我們將SageMath
在Google Colab
. 我們之前發表過一篇文章:“在 Fedora 64 位(10GB)雲虛擬服務器上安裝 SageMath 進行密碼分析”,但為了繼續對比特幣區塊鏈進行密碼分析,我們的許多讀者更喜歡Debian
使用. 據我們所知,它已更新為.Ubuntu
Fedora
Google Colab
"Ubuntu 20.04.5 LTS"
我們可以通過運行命令來檢查這一點:
!cat /etc/lsb-release

因此"Ubuntu 20.04.5 LTS"
,該版本只允許我們安裝SageMath version 9.0, Release Date: 2020-01-01
使用標準安裝命令:
!sudo apt-get install -y sagemath-common

不幸的是這個版本不能正常工作。
為了進行完整的密碼分析,我們將安裝Google Colab
一個全新的版本SageMath version 9.3
文件:Install_SageMath_in_Google_Colab.ipynb 我們發佈在GitHub
我們去官網看看: https: //colab.research.google.com
選擇選項“下載記事本”


現在,通過該實用程序,wget
下載tar-file
:sage-9.3-Ubuntu_20.04-x86_64.tar.bz2
!wget https://cryptodeeptech.ru/sage-9.3-Ubuntu_20.04-x86_64.tar.bz2
!tar -xf sage-9.3-Ubuntu_20.04-x86_64.tar.bz2

讓我們瀏覽一下目錄:
cd SageMath/

打開面板並轉到文件夾:
SageMath

檢查
Python-script:
relocate-once.py是否存在

使用以下命令運行
Python-script:
relocate-once.py :
!python3 relocate-once.py

一切準備就緒!
現在讓我們運行
SageMath
命令:
!./sage -sh

讓我們運行版本檢查命令:
sage -v

好的!
我們有一個新版本: SageMath version 9.3, Release Date: 2021-05-09
實現Twist Attack算法,下載
Python-script:
discrete.py
wget https://raw.githubusercontent.com/demining/CryptoDeepTools/bbd83042e7405508cd2e646ad1b0819da0f9c58d/18TwistAttack/discrete.py

要求解離散對數,
(Pollard's rho algorithm for logarithms)
請運行Python-script:
discrete.py
現在,要獲取私鑰,我們只需要運行命令:
python3 discrete.py

Sage Math 9.3 求解離散對數問題 (Pollard's rho algorithm for logarithms)
現在一切正常!
我們收到了十進制格式的比特幣錢包私鑰,然後我們需要按照專門針對 Twist 攻擊的文章的說明進行密碼分析
電報:https://t.me/cryptodeeptech
視頻素材:https://youtu.be/DBu0UnVe0ig
來源:https://cryptodeep.ru/install-sagemath-in-google-colab
