#keccak256 #svm #hash #solana #no-std #u8

solana-nostd-keccak

A more efficient implementation of Keccak256 for SVM

3 releases

0.1.3 Sep 12, 2024
0.1.2 Sep 12, 2024
0.1.1 Sep 12, 2024

#7 in #keccak256

Download history 78/week @ 2024-11-15 91/week @ 2024-11-22 149/week @ 2024-11-29 348/week @ 2024-12-06 175/week @ 2024-12-13 198/week @ 2024-12-20 64/week @ 2024-12-27 171/week @ 2025-01-03 111/week @ 2025-01-10 81/week @ 2025-01-17 20/week @ 2025-01-24 8/week @ 2025-01-31 69/week @ 2025-02-07 179/week @ 2025-02-14 183/week @ 2025-02-21 207/week @ 2025-02-28

643 downloads per month
Used in 2 crates

MIT license

5KB
63 lines

Solana NoStd Keccak256

A more efficient implementation of Keccak256 for SVM.

Installation

cargo add solana-nostd-keccak

Features

  • Adds hash_ref which takes in any type that implements <AsRef<[u8]>>
  • No Hash struct. Returns [u8;32] directly.
  • Makes use of MaybeUninit to skip zero allocations
  • Adds hash_into to let you hash directly into a mutable buffer.

Performance

library function CU cost
nostd-keccak hashv(&[b"test"]) 100
nostd-keccak hash(b"test") 105
nostd-keccak hash_ref("test") 105
solana-program hashv(&[b"test"]) 121
solana-program hash(b"test") 123

Dependencies

~1.5MB
~17K SLoC