密码学
Rave1sking
二进制安全
展开
-
2020CISCN Crypto lfsr
时隔两个月,看了师傅的wp终于把这道题搞明白了直接看加密源码:def lfsr(state, mask): feedback = state & mask feed_bit = bin(feedback)[2:].count("1") & 1 output_bit = state & 1 state = (state >> 1) | (feed_bit << (N-1)) return state, out原创 2020-10-12 11:14:04 · 406 阅读 · 0 评论 -
2020西湖论剑Crypto BrokenSystem wp
题目打开压缩包的三个文件查看加密代码from Crypto.PublicKey import RSAfrom Crypto.Cipher import PKCS1_OAEPfrom secret import flagimport osrsa = RSA.generate(2048)public_key = rsa.publickey().exportKey()f=open("public.key","w")f.write(public_key.decode())f.close()原创 2020-10-09 20:13:59 · 492 阅读 · 2 评论 -
网鼎杯you_raise_me_up wp
0x01题目:题目很简单就七行代码。#!/usr/bin/env python# -*- coding: utf-8 -*-from Crypto.Util.number import *import randomn = 2 ** 512m = random.randint(2, n-1) | 1c = pow(m, bytes_to_long(flag), n)print 'm = ' + str(m)print 'c = ' + str(c)# m = 391190709124原创 2020-10-07 21:37:15 · 177 阅读 · 0 评论 -
从XCTF best_rsa 学习RSA共模攻击
0x00 RSA原理明文为m,密文为c模n = p*q欧拉函数值φ(n),φ(n)=(p-1)(q-1)公钥参数e和私钥参数d,可由欧拉函数值计算出,e≡d^-1 (mod φ(n));加密:m^e ≡ c (mod n)解密:c^d ≡ m (mod n)0x01 共模攻击的由来所谓共模,就是明文m相同,模n相同,用两个公钥e1,e2加密得到两个私钥d1,d2和两个密文c1,c2共模攻击,即当n不变的情况下,知道n,e1,e2,c1,c2 。可以在不知道d1,d2的情况下,解出m。这里原创 2020-10-06 16:32:32 · 537 阅读 · 1 评论 -
python isqrt()方法
原文Python | math.isqrt() methodLast Updated: 14-01-2020Math module in Python contains a number of mathematical operations, which can be performed with ease using the module.math.isqrt() method in Python is used to get the integer square root of the give原创 2020-10-05 11:47:11 · 1402 阅读 · 0 评论 -
2020巅峰极客Crypto:tryrsa
写在前面化简c1、c2的想法以及最后一步求q感谢:来梦桃子原博客题目from secret import e1,e2,flagfrom Crypto.Util.number import *msg = bytes_to_long("=========Hint:e1="+str(3)+"=============")p = getPrime(512)q = getPrime(512)N = p*qprint (N)print (pow(msg,3,N))msg = bytes_t原创 2020-10-03 21:23:25 · 1128 阅读 · 1 评论