python - What does itsdangerous do to sign the string? -


i want client send me signature can "unsign" found cool package written in python called itsdangerous need...

>>> itsdangerous import signer >>> s = signer('secret-key') >>> s.sign('things , me should know') 'my string.wh6tmhxlgjqb6oy1ut73imlyroa' >>> s.unsign('my string.wh6tmhxlgjqb6oy1ut73imlyroa') 'my string' 

it works perfectly, client not using python how sign string i.e. itsdangerous hash sting client needs recreate.

from their documentation

class itsdangerous.signer(secret_key, salt=none, sep='.', key_derivation=none, digest_method=none, algorithm=none)

this class can sign bytes , unsign , validate signature provided.

salt can used namespace hash, signed string valid given namespace. leaving @ default value or re-using salt value across different parts of application same signed value in 1 part can mean different in part security risk.

then hash (emphasis mine)

default_digest_method()
digest method use signer. this defaults sha1 can changed other function in hashlib module.

so assuming hash, , don't salt afterward, can reproduce result sha-1 hash.


Comments

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -