Packages

SHA-2 for Gleam

Retired package: Deprecated - Use package glesha instead

Current section

Files

Jump to
glesha2 src glesha2.erl
Raw

src/glesha2.erl

-module(glesha2).
-compile([no_auto_import, nowarn_unused_vars]).
-export([hash/2, hmac/3, hex/1]).
-export_type([hash_algorithm/0]).
-type hash_algorithm() :: sha224 | sha256 | sha384 | sha512.
-spec hash(bitstring(), hash_algorithm()) -> bitstring().
hash(Input, Algorithm) ->
sha2_ffi:hash(Input, Algorithm).
-spec hmac(bitstring(), bitstring(), hash_algorithm()) -> bitstring().
hmac(Data, Key, Algorithm) ->
sha2_ffi:hmac(Data, Key, Algorithm).
-spec hex(bitstring()) -> binary().
hex(Input) ->
sha2_ffi:hex(Input).