mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-09 00:08:00 +00:00
update tiny-keccak (#4093)
* update tiny-keccak * fix * Update Cargo.toml * update Cargo.lock * remove keccak-hasher
This commit is contained in:
Generated
+16
-10
@@ -2048,7 +2048,7 @@ dependencies = [
|
||||
"fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libsecp256k1 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libsecp256k1 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"multistream-select 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"parity-multiaddr 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@@ -2381,7 +2381,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "libsecp256k1"
|
||||
version = "0.3.1"
|
||||
version = "0.3.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"arrayref 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@@ -4298,7 +4298,7 @@ name = "sr-io"
|
||||
version = "2.0.0"
|
||||
dependencies = [
|
||||
"hash-db 0.15.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libsecp256k1 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libsecp256k1 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"parity-scale-codec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"sr-std 2.0.0",
|
||||
@@ -4307,7 +4307,6 @@ dependencies = [
|
||||
"substrate-runtime-interface 2.0.0",
|
||||
"substrate-state-machine 2.0.0",
|
||||
"substrate-trie 2.0.0",
|
||||
"tiny-keccak 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -5664,7 +5663,7 @@ dependencies = [
|
||||
"derive_more 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"hex-literal 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libsecp256k1 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libsecp256k1 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"parity-scale-codec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"parity-wasm 0.40.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@@ -5683,7 +5682,6 @@ dependencies = [
|
||||
"substrate-trie 2.0.0",
|
||||
"substrate-wasm-interface 2.0.0",
|
||||
"test-case 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"tiny-keccak 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"wabt 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"wasmi 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"wasmtime-environ 0.2.0 (git+https://github.com/CraneStation/wasmtime.git?rev=71dd73d6)",
|
||||
@@ -5932,7 +5930,7 @@ dependencies = [
|
||||
"hex-literal 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"impl-serde 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libsecp256k1 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libsecp256k1 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"parity-scale-codec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@@ -5953,7 +5951,7 @@ dependencies = [
|
||||
"substrate-runtime-interface 2.0.0",
|
||||
"substrate-serializer 2.0.0",
|
||||
"tiny-bip39 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"tiny-keccak 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"tiny-keccak 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"twox-hash 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"wasmi 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"zeroize 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@@ -6360,7 +6358,6 @@ dependencies = [
|
||||
"criterion 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"hash-db 0.15.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"hex-literal 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"keccak-hasher 0.15.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"memory-db 0.15.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"parity-scale-codec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"sr-std 2.0.0",
|
||||
@@ -6584,6 +6581,14 @@ dependencies = [
|
||||
"crunchy 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tiny-keccak"
|
||||
version = "2.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"crunchy 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tinytemplate"
|
||||
version = "1.0.2"
|
||||
@@ -7780,7 +7785,7 @@ dependencies = [
|
||||
"checksum libp2p-websocket 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0d74d4fc229ad7e8d1a973178786bdcd5dadbdd7b9822c4477c8687df6f82f66"
|
||||
"checksum libp2p-yamux 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1913eb7dd6eb5515957b6f1770296f6921968db87bc9b985f0e974b6657e1003"
|
||||
"checksum librocksdb-sys 5.18.3 (registry+https://github.com/rust-lang/crates.io-index)" = "d19778314deaa7048f2ea7d07b8aa12e1c227acebe975a37eeab6d2f8c74e41b"
|
||||
"checksum libsecp256k1 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "63cc09b49bf0cc55885982347b174ad89855e97a12284d2c9dcc6da2e20c28f5"
|
||||
"checksum libsecp256k1 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "2bd9a7c16c9487e710536b699c962f022266347c94201174aa0a7eb0546051aa"
|
||||
"checksum libz-sys 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)" = "2eb5e43362e38e2bca2fd5f5134c4d4564a23a5c28e9b95411652021a8675ebe"
|
||||
"checksum linked-hash-map 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "ae91b68aebc4ddb91978b11a1b02ddd8602a05ec19002801c5666000e05e0f83"
|
||||
"checksum linked_hash_set 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3c7c91c4c7bbeb4f2f7c4e5be11e6a05bd6830bc37249c47ce1ad86ad453ff9c"
|
||||
@@ -7988,6 +7993,7 @@ dependencies = [
|
||||
"checksum time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "db8dcfca086c1143c9270ac42a2bbd8a7ee477b78ac8e45b19abfb0cbede4b6f"
|
||||
"checksum tiny-bip39 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "c1c5676413eaeb1ea35300a0224416f57abc3bd251657e0fafc12c47ff98c060"
|
||||
"checksum tiny-keccak 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d8a021c69bb74a44ccedb824a046447e2c84a01df9e5c20779750acb38e11b2"
|
||||
"checksum tiny-keccak 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2953ca5148619bc99695c1274cb54c5275bbb913c6adad87e72eaf8db9787f69"
|
||||
"checksum tinytemplate 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "4574b75faccaacddb9b284faecdf0b544b80b6b294f3d062d325c5726a209c20"
|
||||
"checksum tokio 0.1.22 (registry+https://github.com/rust-lang/crates.io-index)" = "5a09c0b5bb588872ab2f09afa13ee6e9dac11e10a0ec9e8e3ba39a5a5d530af6"
|
||||
"checksum tokio-buf 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8fb220f46c53859a4b7ec083e41dec9778ff0b1851c0942b211edb89e0ccdc46"
|
||||
|
||||
@@ -21,8 +21,7 @@ runtime-interface = { package = "substrate-runtime-interface", path = "../runtim
|
||||
externalities = { package = "substrate-externalities", path = "../externalities" }
|
||||
parking_lot = "0.9.0"
|
||||
log = "0.4.8"
|
||||
libsecp256k1 = "0.3.0"
|
||||
tiny-keccak = "1.5.0"
|
||||
libsecp256k1 = "0.3.2"
|
||||
|
||||
cranelift-codegen = { version = "0.46.1", optional = true }
|
||||
cranelift-entity = { version = "0.46.1", optional = true }
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
use codec::Encode;
|
||||
use std::{convert::TryFrom, str};
|
||||
use primitives::{
|
||||
blake2_128, blake2_256, twox_64, twox_128, twox_256, ed25519, sr25519, Blake2Hasher, Pair,
|
||||
blake2_128, blake2_256, twox_64, twox_128, twox_256, ed25519, sr25519, keccak_256, Blake2Hasher, Pair,
|
||||
crypto::KeyTypeId, offchain,
|
||||
};
|
||||
use trie::{TrieConfiguration, trie_types::Layout};
|
||||
@@ -538,11 +538,11 @@ impl_wasm_host_interface! {
|
||||
|
||||
ext_keccak_256(data: Pointer<u8>, len: WordSize, out: Pointer<u8>) {
|
||||
let result: [u8; 32] = if len == 0 {
|
||||
tiny_keccak::keccak256(&[0u8; 0])
|
||||
keccak_256(&[0u8; 0])
|
||||
} else {
|
||||
let mem = context.read_memory(data, len)
|
||||
.map_err(|_| "Invalid attempt to get data in ext_keccak_256")?;
|
||||
tiny_keccak::keccak256(&mem)
|
||||
keccak_256(&mem)
|
||||
};
|
||||
context.write_memory(out, &result)
|
||||
.map_err(|_| "Invalid attempt to set result in ext_keccak_256")?;
|
||||
|
||||
@@ -32,7 +32,7 @@ zeroize = { version = "0.10.1", default-features = false }
|
||||
lazy_static = { version = "1.4.0", default-features = false, optional = true }
|
||||
parking_lot = { version = "0.9.0", optional = true }
|
||||
libsecp256k1 = { version = "0.3.0", default-features = false, optional = true }
|
||||
tiny-keccak = { version = "1.5.0", optional = true }
|
||||
tiny-keccak = { version = "2.0.1", features = ["keccak"], optional = true }
|
||||
substrate-debug-derive = { version = "2.0.0", path = "./debug-derive" }
|
||||
externalities = { package = "substrate-externalities", path = "../externalities", optional = true }
|
||||
primitives-storage = { package = "substrate-primitives-storage", path = "storage", default-features = false }
|
||||
@@ -100,6 +100,7 @@ std = [
|
||||
full_crypto = [
|
||||
"ed25519-dalek",
|
||||
"blake2-rfc",
|
||||
"tiny-keccak",
|
||||
"schnorrkel",
|
||||
"libsecp256k1",
|
||||
"hex",
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
//! Hashing functions.
|
||||
|
||||
use blake2_rfc;
|
||||
use tiny_keccak::{Hasher, Keccak};
|
||||
use twox_hash;
|
||||
|
||||
/// Do a Blake2 512-bit hash and place result in `dest`.
|
||||
@@ -121,3 +122,12 @@ pub fn twox_256(data: &[u8]) -> [u8; 32] {
|
||||
twox_256_into(data, &mut r);
|
||||
r
|
||||
}
|
||||
|
||||
/// Do a keccak 256 hash and return result.
|
||||
pub fn keccak_256(data: &[u8]) -> [u8; 32] {
|
||||
let mut keccak = Keccak::v256();
|
||||
keccak.update(data);
|
||||
let mut output = [0u8; 32];
|
||||
keccak.finalize(&mut output);
|
||||
output
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ pub use impl_serde::serialize as bytes;
|
||||
#[cfg(feature = "full_crypto")]
|
||||
pub mod hashing;
|
||||
#[cfg(feature = "full_crypto")]
|
||||
pub use hashing::{blake2_128, blake2_256, twox_64, twox_128, twox_256};
|
||||
pub use hashing::{blake2_128, blake2_256, twox_64, twox_128, twox_256, keccak_256};
|
||||
#[cfg(feature = "std")]
|
||||
pub mod hexdisplay;
|
||||
pub mod crypto;
|
||||
|
||||
@@ -10,7 +10,6 @@ hash-db = { version = "0.15.2", default-features = false }
|
||||
primitives = { package = "substrate-primitives", path = "../primitives", default-features = false }
|
||||
rstd = { package = "sr-std", path = "../sr-std", default-features = false }
|
||||
libsecp256k1 = { version = "0.3.0", optional = true }
|
||||
tiny-keccak = { version = "1.5.0", optional = true }
|
||||
substrate-state-machine = { path = "../state-machine", optional = true }
|
||||
runtime-interface = { package = "substrate-runtime-interface", path = "../runtime-interface", default-features = false }
|
||||
trie = { package = "substrate-trie", path = "../trie", optional = true }
|
||||
@@ -27,7 +26,6 @@ std = [
|
||||
"trie",
|
||||
"substrate-state-machine",
|
||||
"libsecp256k1",
|
||||
"tiny-keccak",
|
||||
"runtime-interface/std",
|
||||
"externalities",
|
||||
"log",
|
||||
|
||||
@@ -376,7 +376,7 @@ pub trait Crypto {
|
||||
pub trait Hashing {
|
||||
/// Conduct a 256-bit Keccak hash.
|
||||
fn keccak_256(data: &[u8]) -> [u8; 32] {
|
||||
tiny_keccak::keccak256(data)
|
||||
primitives::hashing::keccak_256(data)
|
||||
}
|
||||
|
||||
/// Conduct a 128-bit Blake2 hash.
|
||||
|
||||
@@ -23,7 +23,6 @@ primitives = { package = "substrate-primitives", path = "../primitives", defaul
|
||||
[dev-dependencies]
|
||||
trie-bench = "0.16.2"
|
||||
trie-standardmap = "0.15.2"
|
||||
keccak-hasher = "0.15.2"
|
||||
criterion = "0.2.11"
|
||||
hex-literal = "0.2.1"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user