mirror of
https://github.com/TecharoHQ/anubis.git
synced 2026-04-26 01:52:42 +00:00
wasm: add experimental argon2i checker
Signed-off-by: Xe Iaso <me@xeiaso.net>
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
[package]
|
||||
name = "anubis"
|
||||
version = "0.1.0"
|
||||
edition = "2024"
|
||||
|
||||
[dependencies]
|
||||
@@ -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;
|
||||
Reference in New Issue
Block a user