You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For further examples, as well as different flags to customize output, please see the [documentation](http://hexdocs.pm/siphash/SipHash.html).
34
34
35
-
## Migration to v2.x
35
+
## Migration to v2.1.x
36
36
37
-
Naturally I'm forced to I take back what I said in the v1.1.0 notes; v2.0.0 is now almost 20x faster than the original implementation (when using NIFs). Without NIFs it's only a few microseconds faster than v1.1.0, but faster nonetheless. Turns out the 64-bit masks in v1.x were causing a bottleneck (since they have to be applied so often). Once these were migrated to NIFs, everything became much faster.
37
+
The move to v2.1.x comes with even further performance gains, roughly 3x the speed of v2.0.x. There are a few notable changes in this version bump which make it necessary to document;
38
38
39
-
If for any reason you desire to use the pure Elixir implementation without using NIFs, you can set the`HASH_IMPL`environment variable to `embedded`. Please note that there is likely a significant performance hit when doing this, so I don't recommend it. The embedded implementation is also the fallback in case a NIF cannot be loaded for some reason (a message is logged on startup displaying which implementation is being used).
39
+
Previously, NIFs were disabled by setting`HASH_IMPL` to `embedded` in your environment. As of v2.1.x, there are two places native implementations are used, and so they have to be disabled separately via the `STATE_IMPL` and `UTIL_IMPL` environment variables. Setting them to `embedded` will force them to use an internal Elixir implementation (which will very likely be slower). Both can be disabled independently of each other.
40
40
41
-
This release also made `SipHash.hash/3` come more inline with actual SipHash, in that it returns the numeric result rather than Hex. The reason for this is that the Hex conversion is additional overhead, and it's incorrect to assume everyone wants this format. To replicate the old behaviour, just supply `hex: true` in the option list passed to `SipHash.hash/3` (example above).
41
+
Please also note that as of v2.1.x, the `:padding` key does not change any behaviour. In prior versions it was possible to **not** left-pad your hashes with 0s (in Hex). This has been removed because it make a lot of things a pain, and it's arguably an unneeded use case anyway. As such, all hashes will be left-padded to 16 bytes as required (by default, and unnegotiable).
0 commit comments