pyCheckableString

A hash-checkable string mixin


Keywords
string, hash, python
License
Other
Install
pip install pyCheckableString==0.2.2

Documentation

pyCheckableString

PyPI

pyCheckableString adds checking against a hash to the basic string class. The hash can be automatically recognized.

Install

Just do

pip install pyCheckableString

Example

from pyCheckableString import pyCheckableString

s =  pyCheckableString('the tragicall historye of romeus and juliet')

len(s)
> 43

s.title()
> 'The Tragicall Historye Of Romeus And Juliet'

from hashlib import sha256
s.get_algorithm(sha256(s).digest())
'sha256'

s.check(sha256(s).digest())
> True

s.check('f7ce77e128767ac04ec9beef582e43a0', hexdigest=True)
> False