ktanev
I have used until now this library for ed25519 signing and verifying - Ed25519 — Ed25519 v1.5.1. However, I am not pleased with the library at all. The signing time is 100-120ms and the validating of a signature 150-190ms, which I think could be better. Moreover, I am unable to extract the hash (sha512) used for the signature, which I would really like to have separately.
Do you have any recommendations on a better library for ed25519?
Trending in Questions
I having some trouble figuring out if I have set myself too strict of standards for my production server. Currently I can handle 75% of r...
New
Hello,
I’m trying to build a basic Phoenix web-app, and I’d like to use Tailwind.
However, when I launch mix phx.server, I get an error...
New
Hi everyone,
I am toying with the idea of building a “match maker” for giving personal help to people that wants to start coding.
I sta...
New
I’m working on a small exercise involving update_in/3, and I came up with this solution:
data = %{
name: "Periodic Table",
category:...
New
I’ve got trouble wrapping my head around the order in which functions are called in this snippet (from Phoenix’s authentication):
toke...
New
Is there any way to avoid the Hologram compiler running when using iex? It seems like the front-end code could potentially be disregarded...
New
** (ArgumentError) expected :max_attempts to be a positive integer, got: {:@, [line: 10, column: 19], [{:max_attempts, [line: 10, column:...
New
Other Trending Topics
Edit: 2026 May 15 - This post is archived.
Mob is alive!!
Main docs: mob v0.7.11 — Documentation
A bit of explanation for the slightly c...
New
I am happy to introduce the very α version of the new programming language compiled to BEAM.
Welcome Cure.
It has literally three kille...
New
Hobbes is a low-level distributed database for the Elixir programming language.
Hobbes provides a simple, safe, and scalable storage lay...
New
A little off-topic, but I feel like people here have a good head on their shoulders.
I used to be quite good at making software. Was luc...
New
Hey. Is there anyone here who creates agents in their apps? Not talking about using agents, but creating them. I’m finding it pretty diff...
New
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ai
- #ecto-query
- #elixirconf-us
- #blog-post
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #elixirconf-eu
- #api
- #forms
- #metaprogramming
- #hex










Showing Posts 1 to 10- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
hauleth
This library is implemented purely in Elixir, of course it will be slow. If you want to have faster and built-in implementation, then compile your Erlang with modern OpenSSL (1.1+ IIRC) and then you can use
:cryptomodule directly.ktanev
I have tried generating key using
:crypto.generate_key(:ecdh, :ed25519), but Edwards curves are still not implemented in:crypto.ec_curvesin order to use it (Erlang/OTP 22).hauleth
What is output of
info_lib/0? Because if you have compiled with OpenSSL 1.0 then it will not have Edward’s curves as these are implemented in OpenSSL 1.1 and later. In my case:So there is support for such.
EDIT:
Also if you check
edwards_curve_dh/0type then you will see that you need to use:x25519instead of:ed25519as a curve name.ktanev
The output from
info_lib/0is the same. Creating keys worked without any issues with:x25519, but signing still fails:I have tried using binary instead of string for the message, passing only the key, still no luck…
Here is a discussion from 6 years back for incomplete elliptic curve implementation in Erlang, I suppose it still continues to be that way
Any opinion on the libsalty library - GitHub - ArteMisc/libsalty: Elixir bindings for libsodium (NIF) · GitHub?
hauleth
Yes, now this fails, because when signing you need to use
:ed25519(don’t ask me why this works this way). You need to check documentation ofcrypto:sign/4.I haven’t used
libsalty, but if NaCL is what you need, or you just want to get crypto right without all that hassle, then it is good choice.chura.jey
why does it work this way?
ktanev
Yes, with
:crypto.sign(:eddsa, :sha256, msg, [priv_key, :ed25519])worked! I get between 1.5e-4 and 2.3e-4 in time which is great.However,
:crypto.verify(:eddsa, :sha256, msg, signature, [pub_key, :ed25519])always returns false…EDIT:
I have tested the Salty library and works impressively good - in terms of performance it is even faster than the Erlang
:crypto. For now I will stick with it.ktanev
In
:crypto.generate_key(:ecdh, :ed25519)ecdhrefers to all kinds of eliptic curves and then we usex25519. While in:crypto.sign(:eddsa, :sha256, msg, [priv_key, :ed25519])we have special function for Edwards curves, in which we useed25519.I hope it makes a bit more sense.
geonnave
I believe
:crypto.generate_key(:eddsa, :ed25519)should be used for EdDSA signatures. The curvex25519is only used for key exchange algorithms (likeecdh). Anyway, the:eddsa, :ed25519parameter combination seems to be supported only in Erlang 23.1.Regarding
libsalty, the repo has been archived, so I am not confident in using it.Given this, any ideas? Perhaps the best option will be to depend on Erlang 23.1…
f0rest8
I think this was already solved… but I’ve been playing with the :crypto library recently and it looks like you needed to use a different parameter.
This is an easy mistake to do because of the formatting of the documenation. So, it looks like this:
edwards_curve_dh() = x25519 | x448
edwards_curve_ed() = ed25519 | ed448
But, the params for type :ecdh are the following: ecdh_params() = ec_named_curve() | edwards_curve_dh() | ec_explicit_curve()
If you switch out :ed25519 (which is edwards_curve_ed()) for :x25519, then it’ll work (assuming you’re now using erlang 23+). I’m currently on 23.2.1 and it’s working.