Skip to content

Commit

Permalink
Introduce blake2b-wasm as crate alias of blake2b-ref
Browse files Browse the repository at this point in the history
Signed-off-by: Eval EXEC <execvy@gmail.com>
  • Loading branch information
eval-exec committed Sep 29, 2023
1 parent b49f826 commit 68cf88f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
13 changes: 9 additions & 4 deletions util/hash/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,14 @@ homepage = "https://github.com/nervosnetwork/ckb"
repository = "https://github.com/nervosnetwork/ckb"

[features]
default = ["blake2b-ref", "blake2b-rs"]
ckb-contract = ["blake2b-ref"] # This feature is used for CKB contract development
default = ["blake2b-wasm", "blake2b-native"]
ckb-contract = ["blake2b-wasm"] # This feature is used for CKB contract development

[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
blake2b-native = {package="blake2b-rs", version = "0.2", optional = true}

[target.'cfg(target_arch = "wasm32")'.dependencies]
blake2b-wasm = { package="blake2b-ref", version = "0.3", optional = true}

[dependencies]
blake2b-ref = { version = "0.3", optional = true}
blake2b-rs = { version = "0.2", optional = true}
blake2b-wasm = { package="blake2b-ref", version = "0.3", optional = true}
6 changes: 3 additions & 3 deletions util/hash/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@
#![no_std]

#[cfg(feature = "ckb-contract")]
pub use blake2b_ref::{Blake2b, Blake2bBuilder};
pub use blake2b_wasm::{Blake2b, Blake2bBuilder};

#[cfg(all(not(feature = "ckb-contract"), target_arch = "wasm32"))]
pub use blake2b_ref::{Blake2b, Blake2bBuilder};
pub use blake2b_wasm::{Blake2b, Blake2bBuilder};

#[cfg(all(not(feature = "ckb-contract"), not(target_arch = "wasm32")))]
pub use blake2b_rs::{Blake2b, Blake2bBuilder};
pub use blake2b_native::{Blake2b, Blake2bBuilder};

#[doc(hidden)]
pub const BLAKE2B_KEY: &[u8] = &[];
Expand Down

0 comments on commit 68cf88f

Please sign in to comment.