Skip to main content

Residue class enumeration given partial information of either end.

Project description

enumer

Residue class enumeration given partial information of either end.

Features:

  • enumer. Perform naive enumerations of representatives.
  • tail_enumer. With the last few bits specified. This is done by simple modular arithmetic.
  • head_tail_enumer. With both the last and first few bits specified. This is done by meet-in-the-middle tricks.

Example:

# Python

from secret import secret_message_from_someone
from enumer import *

# E
secret_message = secret_message_from_someone.encode('utf-8')
assert secret_message.startswith(b'Merry Christmas~~~~~~~~~~~~~~~~~~~~')
assert secret_message.endswith(b'padoru padoru!!!!!!!!!!!!!!!!!!!!!!!')
assert len(secret_message) == 191
flag = b2l(secret_message)
mod = int('1337133713371337133713371337133713371337133713371337'
          '1337133713371337133713371337133713371337133713371337'
          '1337133713371337133713371337133713371337133713371337'
          '1337133713371337133713371337133713371337133713371337'
          '1337133713371337133713371337133713371337133713371337'
          '13371337133713371337133713371337133713371337000', 16)
ct = flag % mod
# ct =   0xfcad5e7f12e0fd8a5e8038e0fea85e80031e5e7f06e0fc9a5e7f29
#          e0fd865e7f01e0fca89be0fca25e7f08e0fcbd5e7f2ae0fd875e80
#          0d1e5e810ce0fe875e8126e0fe8f5e8104e0fea89b45dc70e366ed
#          629b70ea6fe476ea1de65ef562e96c9b76ea72e9669b71ee72e666
#          e866e35eed5f3fd20de055822dd862875ed34cce60f11a9d1a9d1a
#          9d1a9d1a9d1a9d1a9d1a9d1a9d1a3ebd0121

# D
head = b'Merry Christmas~~~~~~~~~~~~~~~~~~~~'
tail = b'padoru padoru!!!!!!!!!!!!!!!!!!!!!!!'
length = 191
for pt in head_tail_enumer(ct, mod, head, tail, length, size_limit = 15000):
    if pt == flag:
        print(l2b(pt).decode('utf-8'))

For more examples, refer to enumer/test.

from enumer import run_enumer_tests

run_enumer_tests()

And...

Merry Xmas 🎄🧑‍🎄

Merry Ymas 🎄🧑‍🎄

Merry Zmas 🎄🧑‍🎄

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

enumer-0.1.2.tar.gz (8.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

enumer-0.1.2-py3-none-any.whl (8.4 kB view details)

Uploaded Python 3

File details

Details for the file enumer-0.1.2.tar.gz.

File metadata

  • Download URL: enumer-0.1.2.tar.gz
  • Upload date:
  • Size: 8.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.13

File hashes

Hashes for enumer-0.1.2.tar.gz
Algorithm Hash digest
SHA256 0e94c1d66c9eef6ec8dfa4a90383d080f1d1d7dd9b00f37a2df1171695c534b7
MD5 f2c3b72b9c6e1f72c985256b88ff483f
BLAKE2b-256 150f9299aafdbdad73bc1cca0dde86451de715860c983cb0162001cc2b5c3b52

See more details on using hashes here.

File details

Details for the file enumer-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: enumer-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 8.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.13

File hashes

Hashes for enumer-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 8d37529d2aa39fae0177617dcfc0241705c6f0533bdf01d9aa2b504ceaf0ad09
MD5 421281f7130dc07bfb4cf5bef1ecf2ff
BLAKE2b-256 1f266343ac30fafba2a8134d558e05f9ab7464b11cabaa3457faf5875681bd5c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page