Skip to main content

Text encoding type classifier

Project description

whatenc

PyPI License

Text encoding type classifier.

whatenc is a command-line tool that identifies the encoding or transformation of a given string or file.

The model is trained on text samples from the English, Greek, Russian, Hebrew, and Arabic Wikipedia corpora, chosen to represent a diverse set of writing systems (Latin, Greek, Cyrillic, Hebrew, and Arabic scripts). Each line is encoded using multiple encoding schemes to generate labeled examples.

How It Works

whatenc uses a character-level 1D Convolutional Neural Network trained directly on bigram token sequences.

Each training sample is represented as:

  • bigram of characters, padded to a fixed maximum length
  • a true length scalar feature, allowing the network to learn relative string lengths

This neural approach achieves near-perfect classification accuracy after only a few epochs.

Supported Encodings

whatenc currently recognizes the following formats and transformations:

Category Encodings
Base encodings base32, base64, base85, hex, url
Text ciphers morse
Compression gzip64
Hash digests md5, sha1, sha224, sha256, sha384, sha512

Installation

You can install whatenc using pipx:

pipx install whatenc

Usage

whatenc hello
whatenc samples.txt

Examples

[+] input: ZW5jb2RlIHRvIGJhc2U2NCBmb3JtYXQ=
   [~] top guess   = base64
      [=] base64   = 1.000
      [=] base85   = 0.000
      [=] plain    = 0.000

[+] input: hello
   [~] top guess   = plain
      [=] plain    = 1.000
      [=] md5      = 0.000
      [=] base64   = 0.000

[*] loading model
[+] input: האקדמיה ללשון העברית
   [~] top guess   = plain
      [=] plain    = 1.000
      [=] base64   = 0.000
      [=] base85   = 0.000

[*] loading model
[+] input: bfa99df33b137bc8fb5f5407d7e58da8
   [~] top guess   = md5
      [=] md5      = 0.995
      [=] sha1     = 0.005
      [=] sha224   = 0.000

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

whatenc-0.6.0.tar.gz (8.0 MB view details)

Uploaded Source

Built Distribution

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

whatenc-0.6.0-py3-none-any.whl (8.0 MB view details)

Uploaded Python 3

File details

Details for the file whatenc-0.6.0.tar.gz.

File metadata

  • Download URL: whatenc-0.6.0.tar.gz
  • Upload date:
  • Size: 8.0 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for whatenc-0.6.0.tar.gz
Algorithm Hash digest
SHA256 4b37e5bb3c603a7b1e6b4af8e4459d7d33ca427e7a1877d6d3c75f71200b2f86
MD5 aeb509e261e79a473fdc0b6b2d58d4b3
BLAKE2b-256 3899a18366691756d78eb36227ae247311d54041357026f69dcd6f6a47e94200

See more details on using hashes here.

File details

Details for the file whatenc-0.6.0-py3-none-any.whl.

File metadata

  • Download URL: whatenc-0.6.0-py3-none-any.whl
  • Upload date:
  • Size: 8.0 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for whatenc-0.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 21c6922938bd4ef436caa0b6997025ba4e1c6d6ffc69ba697fa913b2dc6b4c2c
MD5 67872bf7fc217f690db263191f8ee671
BLAKE2b-256 aadf141e00d854012c298ec294d528ccd28d6ca7acf9d62b80b3c1ead40fc50e

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