Skip to content

Commit 7edc191

Browse files
qslg154qslg154
authored andcommitted
new blog
1 parent 81811d1 commit 7edc191

13 files changed

Lines changed: 1392 additions & 127 deletions

File tree

content/posts/Resultant Notes.md

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
+++
2+
date = '2026-01-14T12:04:01+08:00'
3+
draft = false
4+
title = 'Resultant Notes'
5+
math = true
6+
+++
7+
## Multiplication as linear map
8+
Let $p, q$ have degree $m, n\geq 1$ and $R$ be an integral domain.
9+
Consider the linear map $\phi : R_{n-1}[x]\times R_{m-1}[x] \rightarrow R_{a+b-1}[x]$ by:
10+
$$\phi(r, s) = pr + qs$$
11+
>_Theorem 1_
12+
>$\mathrm{Im}\ \phi$ is isomorphic to some $kR_{a+b-1}[x]$ for $k \in R$ if and only if $p, q$ don't have a common factor of positive degree over $Frac(R)$.
13+
14+
_Proof_: If $\phi$ is invertible, then $\phi(r, s) = pr+qs = c$ for some $r, s$ since $\phi$ is surjective. The constant polynomial $c$ assert that no such factor exist. Conversely, if $p, q$ don't have such factor then we can consider the equation $pr = -qs$ , since $p, q$ are coprime over $Frac(R)$,
15+
$p$ must divide $s$ , but $\deg s < m$ so $s = 0$ . Similarly $r=0$ , we have $\ker \phi = {(0, 0)}$, so $\phi$ is injective, thus is an isomorphism .
16+
17+
We can write out the matrix of $\phi$ and calculate its determinant to determine whether $\phi$ is an isomorphism, and whether $p, q$ have a common factor (thus common zero possibly over some field extension)
18+
19+
>_Remark:_ The condition of common factor over $Frac$ is to prevent issues of non-UFD
20+
## Defining the resultant
21+
22+
Let $p = a_mx^m+...+a_0, q = b_n^n+...+b_0$
23+
The matrix of $\phi$ , under the basis $\{1, x, x^2, ..., x^{m+n-1}\}$ is:
24+
25+
$$M = Mat(\phi)= \begin{pmatrix}
26+
a_0 & 0 & \cdots & 0 & b_0 & 0 & \cdots & 0 \\
27+
a_1 & a_0 & \cdots & 0 & b_1 & b_0 & \cdots & 0 \\
28+
a_2 & a_1 & \ddots & 0 & b_2 & b_1 & \ddots & 0 \\
29+
\vdots &\vdots & \ddots & a_0 & \vdots &\vdots & \ddots & b_0 \\
30+
a_m & a_{m-1} & \cdots & \vdots & b_n & b_{n-1} & \cdots & \vdots\\
31+
0 & a_m & \ddots & \vdots & 0 & b_n & \ddots & \vdots \\
32+
\vdots & \vdots & \ddots & a_{m-1} & \vdots & \vdots & \ddots & b_{n-1} \\
33+
0 & 0 & \cdots & a_m & 0 & 0 & \cdots & b_n
34+
\end{pmatrix}$$
35+
> This is called the _Sylvester matrix_
36+
37+
We can define the resultant of $p, q$: $\mathrm{Res}(p, q) = \det(M)$ , since for any polynomial $f$,
38+
$f$ has repeated root if and only $f, f'$ has common zero, we can define $\mathrm{Disc}(f)$ = $\mathrm{Res}(f, f')$ .
39+
40+
> _Corollary 2:_ $Res(p, q) = 0$ if and only $p, q$ share common zeros (possibly over some field extensions)
41+
## Cool applications
42+
43+
> _Theorem 3:_ $\bar{\mathbb{Q}}$ set of algebraic number is closed under addition and multiplication
44+
45+
The idea is to use resultant to construct some bivariate polynomial such that when taking resultant regarding to some variable, we have the resultant, which is a single variable polynomial vanish at the points we need.
46+
47+
_Proof:_ let $x, y \in \bar{\mathbb{Q}}$ , then $p(x) = q(y) = 0$ for some $p, q$ $\in \mathbb{Q}[x]$ .
48+
The polynomial
49+
$$ r(z) = \mathrm{Res}_x(p(x), q(z-x)) $$
50+
has root $x+y$ , and the polynomial
51+
$$ t(z) = \mathrm{Res}_x(p(x), x^nq(z/x))$$
52+
has root $xy$ .
53+
54+
> Such proof applies for $\bar{\mathbb{Z}}$ also.
55+
56+
The method of resultant also comes handy for constructing polynomials for coppersmith attack.
57+
58+
### hkcert2025: Bivariate Copper
59+
60+
```python
61+
from Crypto.Util.number import *
62+
from sage.all import *
63+
message = b'?'
64+
flag = b'?'
65+
66+
m = bytes_to_long(flag)
67+
message = bytes_to_long(message)
68+
69+
p = getPrime(1024)
70+
q = getPrime(25)
71+
N = p * q
72+
e = 65537
73+
74+
c = pow(message, e, N)
75+
r1, r2 = getPrime(512), getPrime(512)
76+
k = getPrime(64)
77+
78+
T1 = (k * inverse(m + r1, p)) % p
79+
T2 = (k * inverse(m + r2, p)) % p
80+
81+
l1 = T1 // 2 ** 244
82+
l2 = T2 // 2 ** 244
83+
84+
# print(f'{e = }')
85+
# print(f'{N = }')
86+
# print(f'{c = }')
87+
88+
# print(f'{k = }')
89+
# print(f'{r1 = }')
90+
# print(f'{r2 = }')
91+
# print(f'{leak1 = }')
92+
# print(f'{leak2 = }')
93+
```
94+
We can factor $N$ easily by brute force, and notice that we have
95+
96+
$$\begin{align} T_i(m+r_i) - k = 0 \pmod{p}\\\end{align}$$
97+
98+
This suggest that we can take
99+
100+
$$ p(t_1, t_2) = \mathrm{Res}_m( T_1(m+r_1) - k, T_2(m+r_2) - k ) = 0$$
101+
102+
by writing $T_i$ as $2^{244}l_i+t_i$ , where $t_i$ are the low bits that we don't know.
103+
We can solve $t_1, t_2$ by using standard coppersmith method.
104+
105+

public/404.html

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88

99
<html lang="en-us" data-theme="">
10-
<head><script src="/livereload.js?mindelay=10&amp;v=2&amp;port=1313&amp;path=livereload" data-no-instant defer></script>
10+
<head>
1111

1212

1313
<meta charset="utf-8">
@@ -24,8 +24,8 @@
2424

2525

2626

27-
<link rel="icon" type="image/x-icon" href="//localhost:1313/favicon.ico">
28-
<link rel="apple-touch-icon-precomposed" href="//localhost:1313/favicon.png">
27+
<link rel="icon" type="image/x-icon" href="/favicon.ico">
28+
<link rel="apple-touch-icon-precomposed" href="/favicon.png">
2929

3030

3131

@@ -67,10 +67,12 @@
6767

6868

6969

70+
71+
7072

7173

7274

73-
<link rel="stylesheet" href="/css/style.4c42aa0abeac804c4933c54677c449cea1f723caae778425d031e98565a0cdef.css" integrity="sha256-TEKqCr6sgExJM8VGd8RJzqH3I8qud4Ql0DHphWWgze8=">
75+
<link rel="stylesheet" href="/css/style.min.44f8240afd8df81b52565c4119ac5ae247776c77fc6d7ccf6e101a6c98abfa7a.css" integrity="sha256-RPgkCv2N&#43;BtSVlxBGaxa4kd3bHf8bXzPbhAabJir&#43;no=">
7476

7577

7678

@@ -85,10 +87,12 @@
8587

8688

8789

90+
91+
8892

8993

9094

91-
<link rel="stylesheet" href="/css/style.9c1888ebff42c0224ce04dac10cb2c401f1b77f54f78e8d87d73c3bed781c263.css" integrity="sha256-nBiI6/9CwCJM4E2sEMssQB8bd/VPeOjYfXPDvteBwmM=">
95+
<link rel="stylesheet" href="/css/style.min.c4c04b3ef88e3d619ad4c7ee5e03048422bc55c4fefdc1f07657c1133670aa22.css" integrity="sha256-xMBLPviOPWGa1MfuXgMEhCK8VcT&#43;/cHwdlfBEzZwqiI=">
9296

9397

9498

@@ -103,10 +107,12 @@
103107

104108

105109

110+
111+
106112

107113

108114

109-
<link rel="stylesheet" href="/css/style.acd606c0fce58853afe0248d37bb41acbbcdd8b1aca2412b6c0fa760da0137f3.css" integrity="sha256-rNYGwPzliFOv4CSNN7tBrLvN2LGsokErbA&#43;nYNoBN/M=">
115+
<link rel="stylesheet" href="/css/style.min.21c5d8fe0a79d623b0adc1ce4bd4f6dd2c05cd939c9aaaa966ba7186b1464f4d.css" integrity="sha256-IcXY/gp51iOwrcHOS9T23SwFzZOcmqqpZrpxhrFGT00=">
110116

111117

112118

@@ -140,11 +146,13 @@
140146

141147

142148

149+
150+
143151

144152

145153

146154

147-
<script src="/js/script.672e2309c296e07c18bcd08b28d797a56222ff941d65f308fba3158c44885b14.js" type="text/javascript" charset="utf-8" integrity="sha256-Zy4jCcKW4HwYvNCLKNeXpWIi/5QdZfMI&#43;6MVjESIWxQ="></script>
155+
<script src="/js/script.min.08f04d96386c73c9bf4d160333f8f448c05a6e01c06770542ee0e013954ce930.js" type="text/javascript" charset="utf-8" integrity="sha256-CPBNljhsc8m/TRYDM/j0SMBabgHAZ3BULuDgE5VM6TA="></script>
148156

149157

150158

@@ -174,7 +182,7 @@
174182
<div class="header-top">
175183
<div class="header-top-left">
176184
<h1 class="site-title noselect">
177-
<a href="//localhost:1313/">qslg154</a>
185+
<a href="/">qslg154</a>
178186
</h1>
179187

180188

@@ -330,13 +338,13 @@ <h1 class="site-title noselect">
330338
<nav class="noselect">
331339

332340

333-
<a class="" href="//localhost:1313/" title="">Home</a>
341+
<a class="" href="/" title="">Home</a>
334342

335-
<a class="" href="//localhost:1313/about/" title="">About</a>
343+
<a class="" href="/about/" title="">About</a>
336344

337-
<a class="" href="//localhost:1313/tags/" title="">Tags</a>
345+
<a class="" href="/tags/" title="">Tags</a>
338346

339-
<a class="" href="//localhost:1313/posts/" title="">Archive</a>
347+
<a class="" href="/posts/" title="">Archive</a>
340348

341349
</nav>
342350

@@ -357,7 +365,7 @@ <h1 class="site-title noselect">
357365

358366
<main id="main">
359367
<div>
360-
<h1 id="title"><a href="//localhost:1313/">Go Home</a></h1>
368+
<h1 id="title"><a href="/">Go Home</a></h1>
361369
Sorry, this Page is not available.
362370
</div>
363371
</main>
@@ -372,7 +380,7 @@ <h1 id="title"><a href="//localhost:1313/">Go Home</a></h1>
372380

373381

374382
<div style="display: flex; align-items: center; gap:8px">
375-
© qslg154, 2025
383+
© qslg154, 2026
376384

377385
</div>
378386
<div style="display:flex; align-items: center; gap:4px">
@@ -399,7 +407,7 @@ <h1 id="title"><a href="//localhost:1313/">Go Home</a></h1>
399407

400408
<p class="h-card vcard">
401409

402-
<a href=//localhost:1313/ class="p-name u-url url fn" rel="me">map[name:qslg154]</a>
410+
<a href=/ class="p-name u-url url fn" rel="me">map[name:qslg154]</a>
403411

404412

405413

public/about/index.html

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88

99
<html lang="en-us" data-theme="">
10-
<head><script src="/livereload.js?mindelay=10&amp;v=2&amp;port=1313&amp;path=livereload" data-no-instant defer></script>
10+
<head>
1111

1212

1313
<meta charset="utf-8">
@@ -25,8 +25,8 @@
2525

2626

2727

28-
<link rel="icon" type="image/x-icon" href="//localhost:1313/favicon.ico">
29-
<link rel="apple-touch-icon-precomposed" href="//localhost:1313/favicon.png">
28+
<link rel="icon" type="image/x-icon" href="/favicon.ico">
29+
<link rel="apple-touch-icon-precomposed" href="/favicon.png">
3030

3131

3232

@@ -68,10 +68,12 @@
6868

6969

7070

71+
72+
7173

7274

7375

74-
<link rel="stylesheet" href="/css/style.4c42aa0abeac804c4933c54677c449cea1f723caae778425d031e98565a0cdef.css" integrity="sha256-TEKqCr6sgExJM8VGd8RJzqH3I8qud4Ql0DHphWWgze8=">
76+
<link rel="stylesheet" href="/css/style.min.44f8240afd8df81b52565c4119ac5ae247776c77fc6d7ccf6e101a6c98abfa7a.css" integrity="sha256-RPgkCv2N&#43;BtSVlxBGaxa4kd3bHf8bXzPbhAabJir&#43;no=">
7577

7678

7779

@@ -86,10 +88,12 @@
8688

8789

8890

91+
92+
8993

9094

9195

92-
<link rel="stylesheet" href="/css/style.9c1888ebff42c0224ce04dac10cb2c401f1b77f54f78e8d87d73c3bed781c263.css" integrity="sha256-nBiI6/9CwCJM4E2sEMssQB8bd/VPeOjYfXPDvteBwmM=">
96+
<link rel="stylesheet" href="/css/style.min.c4c04b3ef88e3d619ad4c7ee5e03048422bc55c4fefdc1f07657c1133670aa22.css" integrity="sha256-xMBLPviOPWGa1MfuXgMEhCK8VcT&#43;/cHwdlfBEzZwqiI=">
9397

9498

9599

@@ -104,10 +108,12 @@
104108

105109

106110

111+
112+
107113

108114

109115

110-
<link rel="stylesheet" href="/css/style.acd606c0fce58853afe0248d37bb41acbbcdd8b1aca2412b6c0fa760da0137f3.css" integrity="sha256-rNYGwPzliFOv4CSNN7tBrLvN2LGsokErbA&#43;nYNoBN/M=">
116+
<link rel="stylesheet" href="/css/style.min.21c5d8fe0a79d623b0adc1ce4bd4f6dd2c05cd939c9aaaa966ba7186b1464f4d.css" integrity="sha256-IcXY/gp51iOwrcHOS9T23SwFzZOcmqqpZrpxhrFGT00=">
111117

112118

113119

@@ -141,11 +147,13 @@
141147

142148

143149

150+
151+
144152

145153

146154

147155

148-
<script src="/js/script.672e2309c296e07c18bcd08b28d797a56222ff941d65f308fba3158c44885b14.js" type="text/javascript" charset="utf-8" integrity="sha256-Zy4jCcKW4HwYvNCLKNeXpWIi/5QdZfMI&#43;6MVjESIWxQ="></script>
156+
<script src="/js/script.min.08f04d96386c73c9bf4d160333f8f448c05a6e01c06770542ee0e013954ce930.js" type="text/javascript" charset="utf-8" integrity="sha256-CPBNljhsc8m/TRYDM/j0SMBabgHAZ3BULuDgE5VM6TA="></script>
149157

150158

151159

@@ -175,7 +183,7 @@
175183
<div class="header-top">
176184
<div class="header-top-left">
177185
<h1 class="site-title noselect">
178-
<a href="//localhost:1313/">qslg154</a>
186+
<a href="/">qslg154</a>
179187
</h1>
180188

181189

@@ -331,13 +339,13 @@ <h1 class="site-title noselect">
331339
<nav class="noselect">
332340

333341

334-
<a class="" href="//localhost:1313/" title="">Home</a>
342+
<a class="" href="/" title="">Home</a>
335343

336-
<a class="" href="//localhost:1313/about/" title="">About</a>
344+
<a class="" href="/about/" title="">About</a>
337345

338-
<a class="" href="//localhost:1313/tags/" title="">Tags</a>
346+
<a class="" href="/tags/" title="">Tags</a>
339347

340-
<a class="" href="//localhost:1313/posts/" title="">Archive</a>
348+
<a class="" href="/posts/" title="">Archive</a>
341349

342350
</nav>
343351

@@ -381,7 +389,7 @@ <h1 class="p-name post-title ">About</h1>
381389

382390

383391
<a class="post-hidden-url u-url" href="/about/">/about/</a>
384-
<a href="//localhost:1313/" class="p-name p-author post-hidden-author h-card" rel="me">map[name:qslg154]</a>
392+
<a href="/" class="p-name p-author post-hidden-author h-card" rel="me">map[name:qslg154]</a>
385393

386394

387395
<div class="post-taxonomies">
@@ -463,7 +471,7 @@ <h1 class="p-name post-title ">About</h1>
463471

464472

465473
<div style="display: flex; align-items: center; gap:8px">
466-
© qslg154, 2025
474+
© qslg154, 2026
467475

468476
</div>
469477
<div style="display:flex; align-items: center; gap:4px">
@@ -490,7 +498,7 @@ <h1 class="p-name post-title ">About</h1>
490498

491499
<p class="h-card vcard">
492500

493-
<a href=//localhost:1313/ class="p-name u-url url fn" rel="me">map[name:qslg154]</a>
501+
<a href=/ class="p-name u-url url fn" rel="me">map[name:qslg154]</a>
494502

495503

496504

0 commit comments

Comments
 (0)