Porting node.js encryption function to Elixir

Thanks for the suggestion and for the wisdom re the code. Yes I’m aware it’s flawed (actually I’m porting it in order to eventually remove it).