Skip to content

Instantly share code, notes, and snippets.

View yytasbag's full-sized avatar

Yaman Yagiz Tasbag yytasbag

View GitHub Profile
@yytasbag
yytasbag / solve.sage
Created July 12, 2020 07:52
TSGCTF 2020 sweet-like-apple-pie
from Crypto.Util.number import *
R1 = RealField(998); R1
RealNumber = R1
# calculate t1 = arcsin(output)
# calculate t2 = pi - t1
# solve linear cong: 10^299 * flag = t2 mod pi
def pi2():
@yytasbag
yytasbag / solve.js
Created July 12, 2020 07:49
TSGCTF 2020 rubikrypto
const Cube = require('cubejs');
const fs = require('fs');
const {randint, buffer2cubes, cubes2buffer} = require('./utils.js');
// use calculated dlogs to get the flag
const pow = (a, n) => {
const r = new Cube();
const x = a.clone();
while (n !== 0n) {
@yytasbag
yytasbag / solve.sage
Created July 12, 2020 07:40
TSGCTF 2020 beginner crypto
from Crypto.Util.number import *
# calculate the solution to 2^10000 * x = 1002773875431658367671665822006771085816631054109509173556585546508965236428620487083647585179992085437922318783218149808537210712780660412301729655917441546549321914516504576 mod 5^174
R.<x> = PolynomialRing(Integers(5^174), implementation='NTL')
f = 2^10000 * x - 1002773875431658367671665822006771085816631054109509173556585546508965236428620487083647585179992085437922318783218149808537210712780660412301729655917441546549321914516504576
print(f.monic())
flag = R(-40911366519048706766028794026595817244329662170458953600729420435667708075268681595360226681630085247360526719063455282924)
print(flag)
flag = long_to_bytes(850582076141850204917088272646087112157789081182432304925852879338520690155230258866308530234671754970789752036398232701)
print(flag)

Keybase proof

I hereby claim:

  • I am yytasbag on github.
  • I am narsist (https://keybase.io/narsist) on keybase.
  • I have a public key ASB7m0d5CKV6QXi2DV-7KFols3uquiAdQYap7npK3PfoIQo

To claim this, I am signing this object: