small-e — Daily AlpacaHack

m^5 < n ゆえに5乗根を求めればOK

code

import os
from Crypto.Util.number import *

FLAG = os.environ.get("FLAG", "Alpaca{dummy}")
assert len(FLAG) < 50

p = getPrime(1024)
q = getPrime(1024)

n = p * q

e = 5 # what????????

m = bytes_to_long(FLAG.encode())
c = pow(m, e, n)

print(f"n = {n}")
print(f"e = {e}")
print(f"c = {c}")

solve

c = 64426504087303951813246838078441662275222839708900359133341615671136342522173619331456628167122546441601604084831803481393964091908425281568746434522937994926680805728974560373917459735665811835839800559253331009380339923486729675042508940809673293031690986041297853338860088143997503137266972063924345287607333207047324410623795727456034926116681588542164755751442528534922088003628572923240330092448273804434443462174179583212626649843445735888430144970416125998013969727919556751231951554897102023125257208495501

m = ZZ(c).nth_root(5)

# 数値をバイト列(文字列)に変換する
# m を Python の標準的な int にキャストし、必要なバイト長を計算して変換
flag_bytes = int(m).to_bytes((int(m).bit_length() + 7) // 8, byteorder='big')

print(flag_bytes.decode('ascii'))

not this (SageMath わからん)

c = 64426504087303951813246838078441662275222839708900359133341615671136342522173619331456628167122546441601604084831803481393964091908425281568746434522937994926680805728974560373917459735665811835839800559253331009380339923486729675042508940809673293031690986041297853338860088143997503137266972063924345287607333207047324410623795727456034926116681588542164755751442528534922088003628572923240330092448273804434443462174179583212626649843445735888430144970416125998013969727919556751231951554897102023125257208495501

r = real_nth_root(c, 5)

from sage.crypto.util import bin_to_ascii

print(bin_to_ascii(r))