naytro
Hi,
Does anyone know how to port this line of code to elixir ? ![]()
mcrypt_decrypt(MCRYPT_RIJNDAEL_256, "secret012345678901112131", base64_decode("EpbcxI+iu6kKVVDFUBSFc3EVGzS+dm9vMcVqImcCvEY="), MCRYPT_MODE_ECB)
# result of this function is "test"
I tried :crypto.crypto_one_time with different ciphers without any luck.
Thanks! ![]()
Trending in Questions
Hello!
Suppose you are building workflow (order / task / payment) processing system with the following requirements:
Each workflow con...
New
I’m in search of an Elixir library that offers PDF generation capabilities similar to Ruby’s Prawn. While there have been discussions abo...
New
I’m looking to build a personal workflow to quickly deploy web applications written in elixir/phoenix, for local consumption (ie not on t...
New
Hey guys,
I’ve got a huge CSV ( around 10 GB ) that needs to be processed hourly
Do you guys have any suggestions what is the best prac...
New
Before I dive in myself, did anyone successfully sprinkle Hologram into their existing LiveView app?
Looking for hints regarding:
Addi...
New
Kia ora,
We have been using elixir-google-api to connect to Google Drive. However, with the updates to Tesla due to CVEs this is now bro...
New
I’ve followed the Phoenix LiveView file upload code here Uploads — Phoenix LiveView v1.0.0-rc.7 and so far everything works just fine wit...
New
Other Trending Topics
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve.
They are GUI (Emerge) and State management (S...
New
Emily is an Elixir library that runs Nx computations on Apple’s MLX. Install it as the default Nx backend and Nx, defn, Axon, Nx.Serving,...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #blog-post
- #phoenix_html
- #ai
- #iex
- #graphql
- #elixirconf-us
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #hex
- #security
- #metaprogramming










Showing Posts 1 to 10- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
soup
Looks like this will handle
RIJNDAEL_256cyphers: elixir-mcrypt/lib/mcrypt.ex at master · system76/elixir-mcrypt · GitHub, Its 6 years old though, probably only built to handle some forward porting of old code. It may still work it may not.Poking around it seems that
MCRYPT_RIJNDAEL_256is a non-standard crypto block size/method, I would not try to implement it in newer code.If you’re working with an existing dataset, porting that to an Elixir application, I would consider decrypting it, then re-encrypting in Elixir with something in the elixir/erlang crypto package (
:cryptoor maybe GitHub - ntrepid8/ex_crypto: Wrapper around the Erlang crypto module for Elixir. · GitHub (not used myself)). This depends on how sensitive your data is though, transport method, etc etc, you will know if this matters or not.If you’re just starting a new project and want to encrypted things then I would look for Elixir specific tutorials (Maybe this? Building an Elixir Encryption Engine with Erlang's Crypto Module).
zoten
I tried a couple of combination while on a coffee break, but couldn’t find the right one, but I’ll leave here some hints that still may help:
:aes_256_ecbAFAIK ← I was wrong, it is a variation, so this post is wrong! Sorry for that, I have been misleaded by poor researchHope there is some useful hint here, working with crypto stuff is always an adventure! Will try again alter maybe, but let us know if you find a correct translation in the meantime!
naytro
According this issue block encoding does not work, so I didn’t even check that
I also can’t change the encryption method or decrypt/re-encrypt existing data because data that was encrypted with this cypher is a cookies data, eventually we going to do that, but this will take about 3 months to propagate, I would like to test elixir a lot sooner
naytro
I will post a solution if I find one
lud
If it is a cookie, is it not acceptable to lose the current data and start with a new algorithm in PHP and Elixir?
naytro
Unfortunately I cannot lose this data
soup
Pass-through to a PHP “”“micro service”“” to decode the cookie and pass it back to Elixir to re-negotiate. Probably what I’d do if pressed and really wanted to get the elixir app into production.
Depends on your timeline, if 3 months is the cutoff, and you wont be in prod before then, just patch the PHP to transform them into reasonable cookies now and not worry about it later?
The PHP code is probably like 10 lines to catch a
POST, hitmcryptand send the response? You only have to hit it once per cookie over that 3 month window, so any performance penalty is probably slim. Run your internal request over HTTPS and it’s still reasonably secure?It’s an idea anyway.
lud
Exactly, if you cannot lose this data then you have to convert to a new encrytption algorithm with PHP and start deploying elixir not before three months. This is the safe way.
Hopefully you will find a way to do the conversion in Elixir directly.
LostKobrakai
I’d probably just embed a small php script in the elixir project and drive it with
System.cmdor a port to encode data to something elixir understands and then reencode in a format more suited to elixir. Add some metric collection to see how often the fallback to php is actually needed and once it’s low enough you can pull the php script from use.soup
Yes, this is the way. Forgot you can just use php directly without other interface. This is pretty easy to deploy and manage while keeping your green fields … greenish.