Packages

A Gleam implementation of CUID2, the secure, collision-resistant ids optimized for horizontal scaling and performance.

Current section

Files

Jump to
glecuid src glecuid@internals@crypto.erl
Raw

src/glecuid@internals@crypto.erl

-module(glecuid@internals@crypto).
-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch, inline]).
-define(FILEPATH, "src/glecuid/internals/crypto.gleam").
-export([hash/1]).
-if(?OTP_RELEASE >= 27).
-define(MODULEDOC(Str), -moduledoc(Str)).
-define(DOC(Str), -doc(Str)).
-else.
-define(MODULEDOC(Str), -compile([])).
-define(DOC(Str), -compile([])).
-endif.
?MODULEDOC(false).
-file("src/glecuid/internals/crypto.gleam", 6).
?DOC(false).
-spec hash(binary()) -> binary().
hash(Input) ->
_pipe = glecuid_ffi:hash(Input),
_pipe@1 = glecuid@internals@util:bit_array_to_base36(_pipe),
gleam@string:drop_start(_pipe@1, 1).