wasm: add experimental argon2i checker

Signed-off-by: Xe Iaso <me@xeiaso.net>
This commit is contained in:
Xe Iaso
2025-04-10 09:47:31 -04:00
parent eb53e156b9
commit d084b7f1a1
10 changed files with 425 additions and 24 deletions
+6
View File
@@ -0,0 +1,6 @@
[package]
name = "anubis"
version = "0.1.0"
edition = "2024"
[dependencies]
+25
View File
@@ -0,0 +1,25 @@
#[cfg(target_arch = "wasm32")]
mod hostimport {
#[link(wasm_import_module = "anubis")]
unsafe extern "C" {
/// The runtime expects this function to be defined. It is called whenever the Anubis check
/// worker processes about 1024 hashes. This can be a no-op if you want.
fn anubis_update_nonce(nonce: u32);
}
/// Safe wrapper to `anubis_update_nonce`.
pub fn update_nonce(nonce: u32) {
unsafe {
anubis_update_nonce(nonce);
}
}
}
#[cfg(not(target_arch = "wasm32"))]
mod hostimport {
pub fn update_nonce(_nonce: u32) {
// This is intentionally blank
}
}
pub use hostimport::update_nonce;