当前位置:网站首页>[ACTF新生赛2020]crypto-aes
[ACTF新生赛2020]crypto-aes
2022-07-27 21:07:00 【[email protected]】
1.题目
from Cryptodome.Cipher import AES
import os
import gmpy2
from flag import FLAG
from Cryptodome.Util.number import *
def main():
key=os.urandom(2)*16
iv=os.urandom(16)
print(bytes_to_long(key)^bytes_to_long(iv))
aes=AES.new(key,AES.MODE_CBC,iv)
enc_flag = aes.encrypt(FLAG)
print(enc_flag)
if __name__=="__main__":
main()
91144196586662942563895769614300232343026691029427747065707381728622849079757
b'\x8c-\xcd\xde\xa7\xe9\x7f.b\x8aKs\xf1\xba\xc75\xc4d\x13\x07\xac\xa4&\xd6\x91\xfe\xf3\x14\x10|\xf8p'
2.复现
key是32位bytes 256位bits iv是16位bytes 128位bits,所以异或的结果高16为bytes、128位bits不变,key又是两个bytes重复16次所以,它的高128位bits和低128位bits是一样的 然后再把key异或x就得到了iv
from Crypto.Cipher import AES
from Crypto.Util.number import*
import os
import gmpy2
x=91144196586662942563895769614300232343026691029427747065707381728622849079757
c=b'\x8c-\xcd\xde\xa7\xe9\x7f.b\x8aKs\xf1\xba\xc75\xc4d\x13\x07\xac\xa4&\xd6\x91\xfe\xf3\x14\x10|\xf8p'
x=long_to_bytes(x)
key=x[:16]*2
iv=bytes_to_long(x)^bytes_to_long(key)
iv=long_to_bytes(iv)
aes=AES.new(key,AES.MODE_CBC,iv)#iv,key的类型为bytes
flag=aes.decrypt(c)
print(flag)
# b'actf{W0W_y0u_can_so1v3_AES_now!}'
版权声明
本文为[[email protected]]所创,转载请带上原文链接,感谢
https://blog.csdn.net/qq_61774705/article/details/124999122
边栏推荐
- [signal processing] weak signal detection in communication system based on the characteristics of high-order statistics with matlab code
- Elk log analysis system installation and deployment
- 新技术引领大中型企业营销新变革,用友BIP CRM重磅发布!
- [signal denoising] signal denoising based on Kalman filter with matlab code
- Character stream learning 14.3
- TFRecord的Shuffle、划分和读取
- 台积电3nm细节曝光:晶体管密度高达2.5亿个/mm²,性能及能效大幅提升
- proteus仿真arduino中调用DHT11/22温湿度传感器
- What are the advantages of Tita's OKR system over other similar products or shared documents?
- Master data management theory and Practice
猜你喜欢

详解分布式系统的幂等
![[number recognition] recognize 0-9 numbers based on Hopfield neural network with matlab code](/img/10/de712b67a7538be03f8fb722271949.png)
[number recognition] recognize 0-9 numbers based on Hopfield neural network with matlab code

2022 summer vacation daily question (5)

Reinforcement learning - pytorch realizes advantage actor critical (A2C)

QT with OpenGL(Shadow Mapping)(平行光篇)

CaEGCN: Cross-Attention Fusion based Enhanced Graph Convolutional Network for Clustering 2021

C#委托用法--控制台项目,通过委托实现事件

Nature review: preferential effects in the formation of microbial communities

远程调试 idea配置remote debug、在远程服务器的程序中,添加JVM启动参数-Xdebug

字符流学习14.3
随机推荐
Introduction to several common usage scenarios of message queue
详解分布式系统的幂等
Figure basic knowledge code
你的列表很卡?这4个优化能让你的列表丝般顺滑
NB-IoT产业的现状与未来:跨过1亿出货门槛,奔向5G大连接!
怎么使用C# Winform实现复制文件显示进度
smartRefresh嵌套多个RecycleView滑动冲突及布局显示不全
四次挥手的Socket交互流程
Socket interaction process of four waves
【C语言】通讯录(动态版本)
JS提升:JS中的数组扁平化问题
硬布线控制器的特点:
RPA流程自动化机器人是什么技术?如何实现办公自动化?
Zabbix4.0使用SNMP代理方式监控vcenter6.5
proteus仿真arduino中调用DHT11/22温湿度传感器
urllib.error. URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: un
The txt file named according to the sequence number is renamed from the back to the front
Ideas, methods and steps of making folding fans with 3DMAX
Is it really hard to understand? What level of cache is the recyclerview caching mechanism?
Master data management theory and Practice