Digital signature implementation in Python