'des-ecb Encryption in elixir/erlang

How do i pass a 24 byte key to elixir/erlang block_encrypt des-ecb cipher.

As a follow up to my previous question How to set a 24 byte length key to elixir/erlang block_encrypt/4 function using des_ede3 as mode of encryption that i was able to get working, Am trying to pass a 24byte key to the key field in elixir/erlang block_encrypt method.

Below is what i have so far.

# this failed
key = "Fget63htyu3nvu28nuineiru34"
<<key_1::binary-8, key_2::binary-8, key_3::binary-8>> = key
cipher = :crypto.block_encrypt(:des_ecb, {key_1, key_2, key_3}, pad(data, 8))

How do i pass the 24 byte length key as an 8 byte key thats required by the des_ecb cipher.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source