Prevent unauthorized access and tampering of encrypted data.
def encrypt(data, key) do
:crypto.block_encrypt(:des_ecb, key, data)
end
This Elixir function uses the DES algorithm to encrypt data. DES is considered insecure due to its small key size, making it susceptible to brute-force attacks.
def encrypt(data, key) do
:crypto.block_encrypt(:aes_ecb, key, data)
end
This Elixir function uses the AES algorithm to encrypt data. AES is a secure encryption algorithm that is resistant to brute-force attacks due to its large key size.