python3 compatibility and code improvements

- fixed python3 compatibility
- fixed crash in macos when operating with functions of family crypto_generic_hash_*
- moved tests to separated file