Skip to main content

A Python wrapper for Andrew Tridgell's spamsum algorithm

Project description

https://img.shields.io/pypi/pyversions/pyspamsum.svg https://img.shields.io/pypi/v/pyspamsum.svg https://img.shields.io/pypi/status/pyspamsum.svg https://img.shields.io/pypi/l/pyspamsum.svg https://travis-ci.org/pybee/pyspamsum.svg?branch=master

spamsum is a fuzzy hash specifically designed for hashing email messages to detect if they are SPAM. The spamsum utility includes the ability to generate the spamsum hash and check a new message against a existing set of hashes to find a match.

pyspamsum is a Python wrapper for the core API of spamsum.

The original spamsum code has been licensed under the terms of the the Perl Artistic License. It has been slightly modified

The original code is Copyright Andrew Tridgell <tridge@samba.org> 2002. It forms part of Andrew’s junkcode, and is available here:

http://www.samba.org/junkcode/#spamsum

The spamsum code in this project is derived from an updated version that was published at Linux.conf.au 2004:

http://linux.anu.edu.au/linux.conf.au/2004/papers/junkcode/spamsum

For details on spamsum itself, please see the spamsum README:

http://samba.org/ftp/unpacked/junkcode/spamsum/README

Installation

At a prompt, run:

$ python setup.py install

Usage

Once installed, here are some examples of usage:

# Import spamsum and set up some strings
>>> import spamsum
>>> s1 = "I am the very model of a modern Major-General, I've information animal and vegetable and mineral"
>>> s2 = "I am the very model of a modern Brigadier, I've information animal and vegetable and something else"
>>> s3 = "Huh? Gilbert and Who?"

# Evaluate the edit distance between two strings
>>> spamsum.edit_distance(s1, s2)
27

# Evaluate the spamsum of some strings
>>> sum1 = spamsum.spamsum(s1)
>>> sum2 = spamsum.spamsum(s2)
>>> sum3 = spamsum.spamsum(s2)
>>> print sum1
3:kEvyc/sFIKwYclQY4MKLFE4Igu0uLzIKygn:kE6Ai3KQ/MKOgDKZn

# Compare two spamsums. 0 = no match, 100 = perfect match.
>>> spamsum.match(sum1, sum1)
100
>>> spamsum.match(sum1, sum2)
72
>>> spamsum.match(sum1, sum3)
0

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

pyspamsum-1.0.5.tar.gz (14.2 kB view details)

Uploaded Source

Built Distributions

pyspamsum-1.0.5-cp39-cp39-macosx_10_15_x86_64.whl (11.2 kB view details)

Uploaded CPython 3.9 macOS 10.15+ x86-64

pyspamsum-1.0.5-cp38-cp38-macosx_10_15_x86_64.whl (11.2 kB view details)

Uploaded CPython 3.8 macOS 10.15+ x86-64

pyspamsum-1.0.5-cp37-cp37m-macosx_10_15_x86_64.whl (11.2 kB view details)

Uploaded CPython 3.7m macOS 10.15+ x86-64

pyspamsum-1.0.5-cp36-cp36m-macosx_10_15_x86_64.whl (11.2 kB view details)

Uploaded CPython 3.6m macOS 10.15+ x86-64

File details

Details for the file pyspamsum-1.0.5.tar.gz.

File metadata

  • Download URL: pyspamsum-1.0.5.tar.gz
  • Upload date:
  • Size: 14.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.0 requests/2.24.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.8.3

File hashes

Hashes for pyspamsum-1.0.5.tar.gz
Algorithm Hash digest
SHA256 ded7fc7b1db4a258c3acfda949a9af1d4a52b46463c158d43e7c06f9f4e7dba0
MD5 76abf1a1f35f225843bc01e3bda02795
BLAKE2b-256 0451a3ad869af8d6932c956a371642ca2a099a05e7492fc037387ada32172ed4

See more details on using hashes here.

File details

Details for the file pyspamsum-1.0.5-cp39-cp39-macosx_10_15_x86_64.whl.

File metadata

  • Download URL: pyspamsum-1.0.5-cp39-cp39-macosx_10_15_x86_64.whl
  • Upload date:
  • Size: 11.2 kB
  • Tags: CPython 3.9, macOS 10.15+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.0 requests/2.24.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.8.3

File hashes

Hashes for pyspamsum-1.0.5-cp39-cp39-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 3d9bfac5896805b1ed88f7a5753995e5898971bf7bcb7952d1c3fe083a55899f
MD5 19b810a15e0926fbe4d9eba4f24ef8f3
BLAKE2b-256 196c52c363f43d9f3cc7cfd12f82ccf02b09dbe7aee1acee9456477325f5e255

See more details on using hashes here.

File details

Details for the file pyspamsum-1.0.5-cp38-cp38-macosx_10_15_x86_64.whl.

File metadata

  • Download URL: pyspamsum-1.0.5-cp38-cp38-macosx_10_15_x86_64.whl
  • Upload date:
  • Size: 11.2 kB
  • Tags: CPython 3.8, macOS 10.15+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.0 requests/2.24.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.8.3

File hashes

Hashes for pyspamsum-1.0.5-cp38-cp38-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 ad71033b0831bc9242972d96eb820698a5fbce2cba6c914e458524757802c1d2
MD5 cd38a00df3d5046d0656fbe79b241b9a
BLAKE2b-256 7610c7510bd222830dedb77f1f0eb0622d2f06c30f55cd50c26fda8b37bb5d5e

See more details on using hashes here.

File details

Details for the file pyspamsum-1.0.5-cp37-cp37m-macosx_10_15_x86_64.whl.

File metadata

  • Download URL: pyspamsum-1.0.5-cp37-cp37m-macosx_10_15_x86_64.whl
  • Upload date:
  • Size: 11.2 kB
  • Tags: CPython 3.7m, macOS 10.15+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.0 requests/2.24.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.8.3

File hashes

Hashes for pyspamsum-1.0.5-cp37-cp37m-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 1edaa615501bbd45dee8af9eb7cb7c068119548e0db1791f97c7dbd9b3a210fd
MD5 b135c04e7d4a70b1e55f9d0692cc51da
BLAKE2b-256 b9a53ef03c389eab8b3db4d41cbc59769fc5c55d74fe4e3d3d6d5f52f8f32ad3

See more details on using hashes here.

File details

Details for the file pyspamsum-1.0.5-cp36-cp36m-macosx_10_15_x86_64.whl.

File metadata

  • Download URL: pyspamsum-1.0.5-cp36-cp36m-macosx_10_15_x86_64.whl
  • Upload date:
  • Size: 11.2 kB
  • Tags: CPython 3.6m, macOS 10.15+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.0 requests/2.24.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.8.3

File hashes

Hashes for pyspamsum-1.0.5-cp36-cp36m-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 df5c918b6e67520377a60faafdf7aef548292d0b7915a5615c46fd48e92e39d0
MD5 4e078631c0092b2addd05126150cbd59
BLAKE2b-256 52235167c43403e8c36beb416f75ca36814e3093297c36d409e6d48220ca595f

See more details on using hashes here.

Supported by

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