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.4.tar.gz (12.1 kB view details)

Uploaded Source

Built Distributions

pyspamsum-1.0.4-cp36-cp36m-macosx_10_12_x86_64.whl (11.8 kB view details)

Uploaded CPython 3.6m macOS 10.12+ x86-64

pyspamsum-1.0.4-cp35-cp35m-macosx_10_12_x86_64.whl (11.8 kB view details)

Uploaded CPython 3.5m macOS 10.12+ x86-64

pyspamsum-1.0.4-cp34-cp34m-macosx_10_12_x86_64.whl (9.9 kB view details)

Uploaded CPython 3.4m macOS 10.12+ x86-64

pyspamsum-1.0.4-cp27-cp27m-macosx_10_12_x86_64.whl (11.6 kB view details)

Uploaded CPython 2.7m macOS 10.12+ x86-64

File details

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

File metadata

  • Download URL: pyspamsum-1.0.4.tar.gz
  • Upload date:
  • Size: 12.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for pyspamsum-1.0.4.tar.gz
Algorithm Hash digest
SHA256 87f5754fe9a5eecfafa32fbea10972abbd4f7c8b8ea8ff6018b8649aa5da246e
MD5 54e8132f68bd8bdcdbdc16574c4f192b
BLAKE2b-256 753bd504d7a2a0a70d57d51a1606bdb43ca97d2f515cc01de6d704d90d869df5

See more details on using hashes here.

File details

Details for the file pyspamsum-1.0.4-cp36-cp36m-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for pyspamsum-1.0.4-cp36-cp36m-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 eab908fa682ce645ec3cc956e40a5664db26e04b380786061aa955303f14f871
MD5 b80a4f4a339474f13e4bf9624b3c7b54
BLAKE2b-256 8d4f64cf417a8971a28a3c75d0af30bb6295c2c05879037a5be8ca9e0247940e

See more details on using hashes here.

File details

Details for the file pyspamsum-1.0.4-cp35-cp35m-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for pyspamsum-1.0.4-cp35-cp35m-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 673df1f5e3426cd4a308306fd1ea55a6545381f5c4fb63a1e0bf7ca3411c9e09
MD5 6a8aaa3661aecb4439e38e8b1f3cec29
BLAKE2b-256 b4f8054fdba398e26c8b780bbadaf2841918f5701930fb43028bb72f4bb0191e

See more details on using hashes here.

File details

Details for the file pyspamsum-1.0.4-cp34-cp34m-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for pyspamsum-1.0.4-cp34-cp34m-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 df9714adb519e54733a0e929b94060a9f2ad9bf1361754e19707f75a3a94237d
MD5 54aeeb67cd1a840209dec1e9918fe7a7
BLAKE2b-256 220abd866a4c38406aea15820bc5710640956aa482a1a190a524b948010e3a64

See more details on using hashes here.

File details

Details for the file pyspamsum-1.0.4-cp27-cp27m-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for pyspamsum-1.0.4-cp27-cp27m-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 3ae1499a1e9d13030222eb22de05cac9ed6883224a34f60d7c5ed5c1d7b6f43f
MD5 787b363dbc914a1213a51d4685e67eba
BLAKE2b-256 455b75ee4d6b3924e0068e675bba2a148bf9d26ddebba20f5b300a89ced913f6

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 Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page