Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Fast EIP-55 checksum library for Elixir

License

NotificationsYou must be signed in to change notification settings

gregors/fast_eip_55

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Encode and validate Ethereum addresses fast!

FastEIP55 is a derivative work of unnawut'sEIP-55 elixir implementation of thespec.

The original version uses a pure elixir version. This version makes 2 substantial changes.

  • replaces pure slow elixir keccak version with the much faster rust-powered oneEx_Keccak
  • replaces easy-to-read logic, with harder-to-read optimized logic

I've kept the library interface the same, and have kept the original tests. I'm taking some liberty with theto_upper logic and might tweak things a bit if I uncover issues. I've also have some additional performance tweaks that I'd like to experiment with. Many thanks to unnawut for the original implemenation and tests!

Installation

The package can be installed by adding:fast_eip_55 to your list of dependencies inmix.exs:

defpdepsdo[{:fast_eip_55,"~> 0.3"}]end

Usage

Encoding:

iex>aliasFastEIP55,as:EIP55iex>EIP55.encode("0x5aaeb6053f3e94c9b9a09f33669435e7ef1beaed"){:ok,"0x5aAeb6053F3E94C9b9A09f33669435E7Ef1BeAed"}iex>EIP55.encode(<<90,174,182,5,63,62,148,201,185,160,...>159,51,102,148,53,231,239,27,234,237>>){:ok,"0x5aAeb6053F3E94C9b9A09f33669435E7Ef1BeAed"}

Validation:

iex>aliasFastEIP55,as:EIP55iex>EIP55.valid?("0x5aAeb6053F3E94C9b9A09f33669435E7Ef1BeAed")trueiex>EIP55.valid?("0x5AAEB6053f3e94c9b9a09f33669435e7ef1beaed")false

Full documentation can be found athttps://hexdocs.pm/fast_eip_55.

Performance

Benchmarking :eip55...Benchmarking :fast_eip55...Name                  ips        average  deviation         median         99th %:fast_eip55      346.97 K        2.88 μs   ±641.72%        2.99 μs        4.99 μs:eip55             2.79 K      357.92 μs     ±7.01%      352.99 μs      448.99 μsComparison::fast_eip55      346.97 K:eip55             2.79 K - 124.19x slower +355.04 μs

License

FastEIP-55 is released under the MIT License. SeeLICENSE for further details.

About

Fast EIP-55 checksum library for Elixir

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages


[8]ページ先頭

©2009-2025 Movatter.jp