Open
Description
Hi! I'm conducting some tests with hashids using a specific set of characters and noticed that the configuration is somehow not being respected?
config :ecto_hashids,
prefix_separator: "-",
characters: "abcdefghijklmnopqrstuvwxyz-+_.~:#[]@!$()",
salt: "my-salted-salt",
prefix_descriptions: %{
char: MyModule
}
iex(1)> EctoHashids.id!({"char", 1})
%{hashid: "char-yabda", pkey: 1, prefix: "char"}
iex(2)> EctoHashids.id!({"char", 2})
%{hashid: "char-7pdma", pkey: 2, prefix: "char"} # <----- where did this 7 came from?
iex(3)> EctoHashids.id!({"char", 3})
%{hashid: "char-ypwxa", pkey: 3, prefix: "char"}
iex(4)> EctoHashids.id!({"char", 4})
%{hashid: "char-raqka", pkey: 4, prefix: "char"}
iex(5)> EctoHashids.id!({"char", 5})
%{hashid: "char-danwp", pkey: 5, prefix: "char"}
I'm not sure where lies the problems because the configuration is passed directly to the respective alphabet
option. Moreover, after testing the lib Hashids directly, it seems to work properly:
Hashids.new(alphabet: "abcdefghijklmnopqrstuvwxyz-+_.~:#[]@!$()", min_len: 5, salt: "my-salted-salt") |> Hashids.encode(2)
Metadata
Assignees
Labels
No labels