Skip to content

Instantly share code, notes, and snippets.

View chalmagean's full-sized avatar
💭
Having fun learning new things every single day

Cezar Halmagean chalmagean

💭
Having fun learning new things every single day
View GitHub Profile
@chalmagean
chalmagean / enc.ex
Last active July 30, 2021 18:42
RC4 encryption/decryption in Elixir/Erlang
# Install https://github.com/rubencaro/cipher first
require Cipher.Helpers, as: H
defmodule Enc do
@random_key H.env(:keyphrase) |> Cipher.Digest.generate_key
def stream_encrypt(xml) do
{_, result} =
:crypto.stream_init(:rc4, @random_key)
|> :crypto.stream_encrypt(xml)