Extract LastFm.API.Signature
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
defmodule LastFm.API.Signature do
|
||||
def generate(params, shared_secret) do
|
||||
encoded_params =
|
||||
params
|
||||
# Params needs to be ASCII ordered alphabetically
|
||||
|> Enum.sort()
|
||||
|> Enum.map_join(fn {key, value} ->
|
||||
"#{key}#{value}"
|
||||
end)
|
||||
|
||||
:crypto.hash(:md5, encoded_params <> shared_secret) |> Base.encode16(case: :lower)
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user