Make bcrypt thread-safe by using a local buffer instead of a static one

I'm involved in a project where we need to use `erlang-bcrypt`, but the main [Smarkets repository](http://github.com/smarkets/erlang-bcrypt) has been unmaintained for over a year. I've collected the most important fixes to it and I'm including them in this pull request. I'm doing it in your repository because it seems to be the most complete of the forks.

The fix I'm including is from the Github user [russor](http://github.com/russor). He/she had fixed a threading problem in erlang-bcrypt when used as a NIF, but had not fixed the problem when used as a port. I added that and rebased against your repository.