ktanev

ktanev

Library for ed25519 signatures

I have used until now this library for ed25519 signing and verifying - https://hexdocs.pm/ed25519/Ed25519.html#content. 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?

Most Liked

hauleth

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:

iex> :crypto.info_lib()
[{"OpenSSL", 269488207, "OpenSSL 1.1.1d  10 Sep 2019"}]
iex> :ed25519 in :crypto.ec_curves()
true

So there is support for such.

EDIT:

Also if you check edwards_curve_dh/0 type then you will see that you need to use :x25519 instead of :ed25519 as a curve name.

hauleth

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 of crypto: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.

ktanev

ktanev

In :crypto.generate_key(:ecdh, :ed25519) ecdh refers to all kinds of eliptic curves and then we use x25519. While in :crypto.sign(:eddsa, :sha256, msg, [priv_key, :ed25519]) we have special function for Edwards curves, in which we use ed25519.
I hope it makes a bit more sense.

f0rest8

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.

Where Next?

Popular in Questions Top

dotdotdotPaul
Okay, I'm having a heck of a time trying to figure out how to best handle the validation of belongs_to associations in Ecto. I'm sure I'...
New
pgiesin
This should be a simple problem but I just can’t seem to figure it out. I have a standalone Elixir app that won’t find the database. Dep...
New
polypush135
As many of you may have realized by now (sorry for all the posts here) I’ve been working on a db problem where I’m trying to aggregate a ...
New
lastday4you
I wanted to check elixir version in phoenix because i found that my elixir is 1.5 but when i use Enum.chunk_by it said the function is un...
New
rms.mrcs
Hi, I need to transform a list of numbers into a map where the keys are the indexes and the values are the original values of the list....
New
fireproofsocks
Forgive me if this is obvious, but how does one delete a database record WITHOUT selecting it first? https://hexdocs.pm/ecto/Ecto.Repo.h...
New
chewm
Hi guys, nice to meet you to the whole forum, I’m new here, I’m trying to configure visual studio code for elixir, right now the intellis...
New
jc00ke
Expanding on this topic: https://forum.elixirforum.net/t/map-typespec-question/19217 Let’s say I have a map with required and optional k...
New
lanycrost
Hi everyone! I need implement if…else if…else condition from my elixir code, and anymore of this control flow structures not work proper...
New
idi527
I’ve been re-reading swift book again and noticed that multiline strings there don’t have a trailing line break, unlike in elixir iex(2)...
New

Other popular topics Top

Brian
What is the proper way to load a module from a file in to IEX? In the python world, doing something like this pretty standard: from ....
New
sorentwo
Hello! tl;dr Announcing Oban, an Ecto based job processing library with a focus on reliability and historical observability. After spen...
977 41022 311
New
itssasanka
Hi all, Trying to get some more clarity over utc_datetime and naive_datetime for Ecto: https://hexdocs.pm/ecto/Ecto.Schema.html#module-...
New
chrismccord
This release brings a number of exciting features, including integration with the new Phoenix LiveDashboard and Phoenix LiveView. There h...
New
lastday4you
I wanted to check elixir version in phoenix because i found that my elixir is 1.5 but when i use Enum.chunk_by it said the function is un...
New
myronmarston
The Elixir Typespec docs show the following syntax for keyword lists in typespecs: # ... | [key: type] # keyword lis...
New
stefanluptak
Hello everybody, usually, I use a 29" ultra-wide monitor for VSCode which can easily accomodate explorer (files panel) + file with code ...
New
johnnyicon
Hi all, I've just started learning Elixir and Phoenix Framework, so please pardon my n00bness at this stage. I'm trying to use Postg...
New
belgoros
I’m not a pro in using Regex and can’t figure out why the following behaviour happens, especially if we take into account the difference ...
New
lanycrost
Hi everyone! I need implement if…else if…else condition from my elixir code, and anymore of this control flow structures not work proper...
New

We're in Beta

About us Mission Statement