Skip to main content

a Statistical PUzzle TexT procEssoR library

Project description

sputter

sputter is a Statistical PUzzle TexT procEssoR. It is a Python library that can be used for many kinds of cryptanalysis and text transformation tasks that are often helpful when solving puzzle hunts.

Example usages

The sputter command line tool serves as an example of how to use the sputter library, and may also be useful on its own, as demonstrated by the examples below.

$ uv run sputter crack-caesar 'QEB NRFZH YOLTK CLU GRJMP LSBO QEB IXWV ALD'
03 THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG 358.7871900461235
23 NBY KOCWE VLIQH ZIR DOGJM IPYL NBY FUTS XIA 558.2539523522809
07 XLI UYMGO FVSAR JSB NYQTW SZIV XLI PEDC HSK 566.445149039387
13 DRO AESMU LBYGX PYH TEWZC YFOB DRO VKJI NYQ 567.3074406217602
19 JXU GKYSA RHEMD VEN ZKCFI ELUH JXU BQPO TEW 568.091701966427
$ uv run sputter crack-substitution 'IDTG GYPIYPCY EJUY FB VL QYHJITRYHW CVEEVP YPOHTGD SVQUG TG FGYU JG J IYGI CJGY LVQ IDY GFNGITIFITVP CTBDYQ CQJCXYQ'
JNCUYLODTAXHEPVBMQGIFRSKWZ 161.51 THIS SENTENCE MADE UP OF RELATIVELY COMMON ENGLISH WORDS IS USED AS A TEST CASE FOR THE SUBSTITUTION CIPHER CRACKER
JNCUYLODTAXHEPVBKQGIFRSMWZ 161.51 THIS SENTENCE MADE UP OF RELATIVELY COMMON ENGLISH WORDS IS USED AS A TEST CASE FOR THE SUBSTITUTION CIPHER CRACKER
JNCUYLODTAXHEPVBMQGIFRSKWZ 161.51 THIS SENTENCE MADE UP OF RELATIVELY COMMON ENGLISH WORDS IS USED AS A TEST CASE FOR THE SUBSTITUTION CIPHER CRACKER
JNCUYLODTMXHEPVBAQGIFRSZWK 161.51 THIS SENTENCE MADE UP OF RELATIVELY COMMON ENGLISH WORDS IS USED AS A TEST CASE FOR THE SUBSTITUTION CIPHER CRACKER
JNCUYLODTKXHEPVBAQGIFRSZWM 161.51 THIS SENTENCE MADE UP OF RELATIVELY COMMON ENGLISH WORDS IS USED AS A TEST CASE FOR THE SUBSTITUTION CIPHER CRACKER
$ uv run sputter crack-vigenere 5 LXFOPVEFRNHR
HENNY ETSBROASEPAN 99.96089810813712
LEMON ATTACKATDAWN 100.0337193614982
DIRAC IPOONSWORLEJ 103.72768482103916
DECOR ITDAYSADDWEN 105.64900698963312
DENNY ITSBRSASEPEN 108.95957454786881
$ uv run sputter evaluate-word-features STEPSISTERS ERNIEELS SINNFEIN NINEONEONE SUSPENDEDSENTENCE
    -26.62 at least 5 cardinal directions ['STEPSISTERS', 'ERNIEELS', 'SINNFEIN', 'NINEONEONE', 'SUSPENDEDSENTENCE']
    -20.31 at least 3 occurrences of N ['SINNFEIN', 'NINEONEONE', 'SUSPENDEDSENTENCE']
    -19.39 at least 4 cardinal directions ['STEPSISTERS', 'ERNIEELS', 'SINNFEIN', 'NINEONEONE', 'SUSPENDEDSENTENCE']
    -15.15 at least 3 occurrences of E ['ERNIEELS', 'NINEONEONE', 'SUSPENDEDSENTENCE']
    -12.76 at least 3 occurrences of S ['STEPSISTERS', 'SUSPENDEDSENTENCE']
$ uv run sputter unweave --max-words=5 TFMTHUREUOSDRISNDDDAAAYAYYY
     42.03 ['THURSDAY', 'FRIDAY', 'MONDAY', 'TUESDAY']
     50.53 ['THURSDAY', 'FRIDAY', 'MON', 'TUESDAY', 'DAY']
     53.99 ['THURSDAY', 'FRI', 'MONDAY', 'TUESDAY', 'DAY']
     54.73 ['THURSDAY', 'FRIDA', 'MONDAY', 'TUESDAY', 'Y']
     55.60 ['THUDS', 'FRIDAY', 'MORNAY', 'TUESDAY', 'DAY']

Development instructions

Install uv.

Install the pre-commit hooks:

$ uv run pre-commit install

Run tests:

$ uv run pytest

Run code coverage:

$ uv run coverage run -m pytest
$ uv run coverage report
$ uv run coverage html

Run linter and code formatter:

$ uv run ruff check
$ uv run ruff format

Build documentation:

$ uv run pdoc --output-dir=docs src/sputter

Run all pre-commits:

$ uv run pre-commit run --all-files

Acknowledgments

The word_features module was inspired by (and is more-or-less a Python port of) the Collective.jl library by Robin Deits.

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

sputter-0.1.2.tar.gz (1.6 MB view details)

Uploaded Source

Built Distribution

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

sputter-0.1.2-py3-none-any.whl (1.6 MB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: sputter-0.1.2.tar.gz
  • Upload date:
  • Size: 1.6 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for sputter-0.1.2.tar.gz
Algorithm Hash digest
SHA256 79de466f7b25defa45f4f6cd02ae79c62bab37e76b947b6e342477f7247abb84
MD5 2a16051bdf0119a8ba088a32fd401edd
BLAKE2b-256 263cc60a51385a947aca7cbc8cb4af203b7bc52c9b36eab011c301e411677b8e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: sputter-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 1.6 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for sputter-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 dbfcadd65c6b0a4626993ae657451ba15a9c0d55a4074f37617e5221a4a3e6b3
MD5 7b3cdcbb23c1e80f9fb4eb11ae2cd544
BLAKE2b-256 1002b59a7064ee788373d238c65b899ad9c85ccfd24a1cf6a9bb2bc5280df38c

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