trendy windy trigonity

solved by tomato

have you seen Tan challenge before? see maple version pi documentation!

This is just a code dump or so, youtube video writeup is here.

chall.sage
1
2
3
4
5
6
7
8
9
10
11
from Crypto.Util.number import bytes_to_long
flag = REDACTED 
print(len(flag)) 
R = RealField(1000)
a,b = bytes_to_long(flag[:len(flag)//2]),bytes_to_long(flag[len(flag)//2:])
x   = R(0.75872961153339387563860550178464795474547887323678173252494265684893323654606628651427151866818730100357590296863274236719073684620030717141521941211167282170567424114270941542016135979438271439047194028943997508126389603529160316379547558098144713802870753946485296790294770557302303874143106908193100)

enc = a*cos(x)+b*sin(x) 

#38
#2.78332652222000091147933689155414792020338527644698903976732528036823470890155538913578083110732846416012108159157421703264608723649277363079905992717518852564589901390988865009495918051490722972227485851595410047572144567706501150041757189923387228097603575500648300998275877439215112961273516978501e45

Solve using LLL:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# sage
from Crypto.Util.number import bytes_to_long as btl, long_to_bytes as ltb
R = RealField(1000)
x = R(0.75872961153339387563860550178464795474547887323678173252494265684893323654606628651427151866818730100357590296863274236719073684620030717141521941211167282170567424114270941542016135979438271439047194028943997508126389603529160316379547558098144713802870753946485296790294770557302303874143106908193100)
res = 2.78332652222000091147933689155414792020338527644698903976732528036823470890155538913578083110732846416012108159157421703264608723649277363079905992717518852564589901390988865009495918051490722972227485851595410047572144567706501150041757189923387228097603575500648300998275877439215112961273516978501e45

c = round(cos(x) * 10^300)
s = round(sin(x) * 10^300)
r = round(res * 10^300)
L = Matrix([
[c, 1, 0, 0],
[s, 0, 1, 0],
[-r, 0, 0, 1]
])
W = diagonal_matrix(
[1, 1, 1, 1]
)
reduced = (L*W).LLL()/W
assert reduced[0][-1]==1
a,b = reduced[0][1:3]
print(ltb(int(a)) + ltb(int(b)))

giving the flag CSCTF{Trigo_453_Tr3ndy_FuN_Th35e_D4Y5}