Skip to main content

whatenc

PyPI License

Blog

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

API

from whatenc import Classifier

classifier = Classifier()
print(classifier.predict("hello, world!")) # returns: [('plain', 1.0), ('md5', 7.686760500681856e-26), ('base85', 2.864714171264974e-35)]

CLI

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.999
      [=] sha1     = 0.001
      [=] sha224   = 0.000

Metadata

Release files for whatenc 0.9.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for whatenc 0.9.1
File Size Uploaded
whatenc-0.9.1.tar.gz 7.8 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for whatenc 0.9.1
File Interpreter ABI Platform
whatenc-0.9.1-py3-none-any.whl Python 3 none any Details

Total release size: 15.6 MB

Release files / whatenc-0.9.1.tar.gz

Download URL whatenc-0.9.1.tar.gz
Size 7.8 MB
Tags Source
SHA-256 checksum
How to use checksums
473b44a271839dba4ed25580baae1254a765318c266b3ce461cb69dbb0bfc561
BLAKE2b-256 checksum
How to use checksums
295becc5f581286933d41f58ed00af38d570a211658fb5e2276cc9e610867c36
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.11

Release files / whatenc-0.9.1-py3-none-any.whl

Download URL whatenc-0.9.1-py3-none-any.whl
Size 7.8 MB
Tags Python 3
SHA-256 checksum
How to use checksums
1fd774ab242999c6ee90229e26a2830d543179e34cc6182edab4a3d98940bbbb
BLAKE2b-256 checksum
How to use checksums
6615bc3d68854d9087c4bd51f88f2d86341ec4bf5fd3a8cf3685b2a508c5a6b5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.11

Release history Release notifications | RSS feed

This release

0.9.1 This release

2 release files

0.9.0

2 release files

0.8.0

2 release files

0.7.1

2 release files

0.7.0

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page