CRYTPO 24.8第一周刷题记录
[SWPUCTF 2021 新生赛]crypto3 123456789101112131415161718192021from gmpy2 import *from Crypto.Util.number import *flag = '******************'p = getPrime(512)q = getPrime(512)m1 = bytes_to_long(bytes(flag.encode()))n = p*qflag1 = pow(m1,p,n)flag2 = pow(m1,q,n)print('flag1= '+str(flag1))print('flag2= '+str(flag2))print('n= '+str(n))#flag1=...
Codeforces Round 963 (Div. 2)题解
题目链接 本场比赛应该算是今年我打的第一场算法竞赛,也是NOIP2021结束之后难得发挥出来的比赛。ABC都是比较简单的题,D是二分+dp,比较难想 E最终还是不会,疑似是一个高级dp A.Question Marks 观察样例就能打出来 12345678910111213141516171819202122232425#include<iostream>#include<string>using namespace std;signed main(){ int t;cin >> t; while( t -- ){ string s;int n;cin >> n;cin >> s; int a , b , c , d , e;a = b = c = d = e = 0; for(int i = 0;i < s.length();i ++){ if( s[i] == 'A' ) a ++;...
BUUCTF crypto wp
[NewStarCTF 2023 公开赛道]Rabin’s RSA12345678910111213141516171819from Crypto.Util.number import *from secret import flagp = getPrime(64)q = getPrime(64)assert p % 4 == 3assert q % 4 == 3n = p * qe = 2m = bytes_to_long(flag)c = pow(m,e,n)print('n =', n)print('c =', c)# n = 201354090531918389422241515534761536573# c = 20442989381348880630046435751193745753 Rabin加密算法——一种基于摸平方和模平方根的非对称加密 特点: 同一密文,可能有两个以上对应的明文 破解该体制等价于对大整数的分解 满足 $p\equiv 3\mod4$ 且 $q\equiv 3\mod4$ Rabin密码体制选取...
数论小芝士
欧拉定理:https://oi-wiki.org/math/number-theory/fermat/ 123456789101112131415#[LitCTF 2023]Eulerfrom Crypto.Util.number import *from secret import flagm = bytes_to_long(flag)p = getPrime(512)q = getPrime(512)n = p*qc = pow(m,n-p-q+3,n)print(f'n = {n}')print(f'c = {c}')"""n = c = """ $phi = n-p-q+1$,故 $c=m^{phi+2} mod \ n$ ,由欧拉定理可得 $c^{phi}\equiv 1 \ mod n $ 则 $c\equiv m^{2} mod \ n $ 直接开根即可 1234import gmpy2from...
制导镖
...
install crypto in sage of wsl
When I input sudo -pip install pycryptodome It output 12345678910111213141516171819202122root@LAPTOP-LDQVJGQS:/mnt/c/Users/coper# python3 -m pip install --user pipxerror: externally-managed-environment× This environment is externally managed╰─> To install Python packages system-wide, try apt install python3-xyz, where xyz is the package you are trying to install. If you wish to install a non-Debian-packaged Python package, create a virtual environment using python3 -m...
hexo usage
hexo s #启动并预览 hexo c #清除缓存文件 db.json 和已生成的静态文件 public hexo g #生成网站静态文件到默认设置的 public 文件夹(hexo generate 的缩写) hexo d #自动生成网站静态文件,并部署到设定的仓库(hexo deploy 的缩写)