Convert Elixir functions to PHP
Budget: $50 – $60 USD
I need a developer who has rich experience in Elixir and PHP.
If you can convert these functions to PHP, Please send a proposal with your PHP code.
def encrypt(plaintext, key \\ default_secret_key()) do
iv = :crypto.strong_rand_bytes(16)
hashed_key = :crypto.hash(:sha256, key)
{ciphertext, tag} = :crypto.block_encrypt(:aes_gcm, hashed_key, iv, {"AES256GCM", plaintext |> to_string(), 16})
iv <> tag <> ciphertext
end
def decrypt(ciphertext, key \\ default_secret_key()) do
<<iv::binary-16, tag::binary-16, ciphertext::binary>> = ciphertext
hashed_key = :crypto.hash(:sha256, key)
:crypto.block_decrypt(:aes_gcm, hashed_key, iv, {"AES256GCM", ciphertext, tag})
end
If you can convert these functions to PHP, Please send a proposal with your PHP code.
def encrypt(plaintext, key \\ default_secret_key()) do
iv = :crypto.strong_rand_bytes(16)
hashed_key = :crypto.hash(:sha256, key)
{ciphertext, tag} = :crypto.block_encrypt(:aes_gcm, hashed_key, iv, {"AES256GCM", plaintext |> to_string(), 16})
iv <> tag <> ciphertext
end
def decrypt(ciphertext, key \\ default_secret_key()) do
<<iv::binary-16, tag::binary-16, ciphertext::binary>> = ciphertext
hashed_key = :crypto.hash(:sha256, key)
:crypto.block_decrypt(:aes_gcm, hashed_key, iv, {"AES256GCM", ciphertext, tag})
end