Packages

A collection of Gleam utilities all written in pure gleam

Current section

Files

Jump to
glib src glib@hash.erl
Raw

src/glib@hash.erl

-module(glib@hash).
-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch]).
-export([hash/1]).
-spec hash(binary()) -> integer().
hash(Value) ->
_pipe = gleam@string:to_utf_codepoints(Value),
gleam@list:fold(
_pipe,
0,
fun(Acc, X) -> gleam@string:utf_codepoint_to_int(X) + (31 * Acc) end
).