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/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.1.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.1-py3-none-any.whl (8.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: enumer-0.1.1.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.1.tar.gz
Algorithm Hash digest
SHA256 c3954300379a470d4825be976e403cb9c5976a3692ff73fce130c89c9f07d5d3
MD5 542142e349be220fe15b2623ad265460
BLAKE2b-256 cfdf43eb13a5d357e07ecb4a15eeeed5b025aa3e0aed17360c32d3e5ccc37259

See more details on using hashes here.

File details

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

File metadata

  • Download URL: enumer-0.1.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 76043094879a98ad73c8926b85361702f49cc9ee1d89238891b587aa520d765d
MD5 bc77f14196480ba01a9e3ed448b27c89
BLAKE2b-256 7c84d3ed18161d2d1800d3493caac389db555283a70dbc56c46c76e7a0d97aad

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