Skip to content

Instantly share code, notes, and snippets.

@shuax
Created December 5, 2023 09:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shuax/e78f2cceecfb7a0273af8159a9415778 to your computer and use it in GitHub Desktop.
Save shuax/e78f2cceecfb7a0273af8159a9415778 to your computer and use it in GitHub Desktop.
from sympy import isprime
N = "ED4C27A0C3E6C655D9FAE2AFBFC913A134C1732DB806E1AD21EC97E46A3206F8B1B62DAF2B709A27ECFAF46D5FC0C2398820F2A8E09A45321E69D2929BD6324FCF8D6CEE887E153DBB4DF83E3DDCF7AB5741A48DB627D894FEC949F1FB47490CF60B75D102CC63D2A899D8135155D4A2BA599AC6F882B8F622CD61965A9389734BE8BC519A94DD46F3824D24D720B649F9CDB11A7CE4AA3C1498C7E971BC886B3BC1888B5F42B1981FDF51E1CB9699FDF78A0EF2ABE43BC763D2C692F1C5B119B5448B04E29ED88C584E38D9B899CC6C30583593BABAE8FA01AFE40314DA2AFBCA1D83CF3E614E9CB8CE4F097046F0FBD306084DBD3B2E14F1006952DF646B3B"
N = bytearray(bytes.fromhex(N))
print(N.hex())
ok = False
for j in range(len(N)):
for i in range(256):
M = N.copy()
M[-j] = i
X = int.from_bytes(M)
if isprime(X):
print(j, i, hex(X))
ok = True
break
if ok:
break
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment