Pbkdf2: Use it everywhere.

This commit is contained in:
Lain Soykaf 2021-01-14 15:06:16 +01:00
commit 39f3683a06
21 changed files with 37 additions and 127 deletions

View file

@ -5,10 +5,10 @@
defmodule Pleroma.Password.Pbkdf2Test do
use Pleroma.DataCase, async: true
alias Pleroma.Password.Pbkdf2
alias Pleroma.Password.Pbkdf2, as: Password
test "it generates the same hash as pbkd2_elixir" do
# hash = Pleroma.Password.Pbkdf2.hash_pwd_salt("password")
# hash = Pbkdf2.hash_pwd_salt("password")
hash =
"$pbkdf2-sha512$1$QJpEYw8iBKcnY.4Rm0eCVw$UBPeWQ91RxSv3snxsb/ZzMeG/2aa03c541bbo8vQudREGNta5t8jBQrd00fyJp8RjaqfvgdZxy2rhSwljyu21g"
@ -19,14 +19,14 @@ defmodule Pleroma.Password.Pbkdf2Test do
end
@tag skip: "Works when Pbkd2 is present. Source: trust me bro"
test "Pleroma.Password.Pbkdf2 can verify passwords generated with it" do
hash = Password.hash_pwd_salt("password")
assert Pleroma.Password.Pbkdf2.verify_pass("password", hash)
test "Pbkdf2 can verify passwords generated with it" do
# Commented to prevent warnings.
# hash = Password.hash_pwd_salt("password")
# assert Pbkdf2.verify_pass("password", hash)
end
test "it verifies pbkdf2_elixir hashes" do
# hash = Pleroma.Password.Pbkdf2.hash_pwd_salt("password")
# hash = Pbkdf2.hash_pwd_salt("password")
hash =
"$pbkdf2-sha512$1$QJpEYw8iBKcnY.4Rm0eCVw$UBPeWQ91RxSv3snxsb/ZzMeG/2aa03c541bbo8vQudREGNta5t8jBQrd00fyJp8RjaqfvgdZxy2rhSwljyu21g"