Please refer to the notes for the Erlang standard library: crypto about possibly using a higher-level library rather than the primitives provided here.