#NEWLINE# def compare_token( compare , token ) : #NEWLINE# #INDENT# 'compare a token with a hashed token\n    \n    uses the same algorithm and salt of the hashed token for comparison\n    ' #NEWLINE# ( algorithm , srounds , salt , _ ) = compare . split ( ':' ) #NEWLINE# hashed = hash_token ( token , salt = salt , rounds = int ( srounds ) , algorithm = algorithm ) . encode ( 'utf8' ) #NEWLINE# compare = compare . encode ( 'utf8' ) #NEWLINE# if compare_digest ( compare , hashed ) : #NEWLINE# #INDENT# return True #NEWLINE# #UNINDENT# return False