defmodule My do defstruct password: "", apassword_hash: "", aencrypted_password: "" end m = %My{ :password => "123", :apassword_hash => Bcrypt.hash_pwd_salt("111111"), :aencrypted_password => Bcrypt.hash_pwd_salt("111111") } temp = %{:hash_key => "apassword_hash"} re = Bcrypt.check_pass(m, "111111", %{:hash_key => :apassword_hash}) IO.puts(temp[:hash_key]) IO.puts(Map.get(m, :apassword_hash)) IO.inspect(re)