Skip to content

Instantly share code, notes, and snippets.

View tai-ga's full-sized avatar
🍣

Masahiro Ono tai-ga

🍣
View GitHub Profile
@tai-ga
tai-ga / rsa_common_factor_demo.go
Last active March 18, 2025 09:05
公開鍵から秘密鍵を再構築するデモ:RSA鍵生成時の弱い乱数で共通素因数が使われた場合の脆弱性、GCDでその素因数を検出し秘密鍵を構築
package main
import (
"crypto/rand"
"crypto/rsa"
"crypto/x509"
"encoding/pem"
"fmt"
"log"