paillier暗号
#angstromCTF2019 https://ctftime.org/task/8339 The year is 20XX. ångstromCTF only has pwn challenges, and the winner is solely determined by who can establish a socket connection first. In the data remnants of an ancient hard disk, we've r…
#googlectf2022 #!/usr/bin/python3 # Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at …
検証可能な暗号(復号の途中に不正な暗号を検出できる) 加法準同型性を持つ (ベースが Paillier暗号なんだな) 鍵生成 安全素数 を選び、 を計算する と をランダムに選ぶ を計算する 適当なハッシュ用の鍵 を生成する 公開鍵: 秘密鍵: パラメータ: 暗…
#bsidesahmedabadctf_2021 import os from Crypto.Util.number import getPrime, getRandomNBitInteger flag = os.getenv("FLAG", "XXXX{sample_flag}").encode() m = int.from_bytes(flag, 'big') p = getPrime(512) y = pow(1 + p, m, p**3) assert m < p …
#angstromCTF2019 https://ctftime.org/task/8346 Our remote eightball has state of the art encryption protecting the contents of any question asked to it. nc 54.159.113.26 19000 from gmpy2 import div, gcd, invert, powmod from Crypto.Util.num…
Paillier暗号 https://furutsuki.hatenablog.com/entry/2020/06/01/023111#cryptorev-S1-Protocol
#grabcon2021 from math import sqrt import random from Crypto.Util.number import bytes_to_long N = 243398471445086096158902751815981037056185671606395615732185670597594848933757044595783312066844386797549036301933553034317912968950101762681…
#TSGCTF_2021 #hakatashi # See also https://github.com/tsg-ut/pycryptodome from Crypto.PublicKey import DSA from Crypto.Signature import DSS from Crypto.Hash import SHA256 from Crypto.Util.number import getPrime from Crypto.Random.random im…