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]).
-file("src/glib/hash.gleam", 4).
-spec hash(binary()) -> integer().
hash(Value) ->
_pipe = gleam@string:to_utf_codepoints(Value),
gleam@list:fold(
_pipe,
0,
fun(Acc, X) -> gleam_stdlib:identity(X) + (31 * Acc) end
).