[keccak-hasher]: rust2018 (#11163)
This commit is contained in:
parent
9d313e31e6
commit
4f25d43516
@ -1,6 +1,7 @@
|
||||
[package]
|
||||
name = "keccak-hasher"
|
||||
version = "0.1.1"
|
||||
edition = "2018"
|
||||
authors = ["Parity Technologies <admin@parity.io>"]
|
||||
description = "Keccak-256 implementation of the Hasher trait"
|
||||
license = "GPL-3.0"
|
||||
|
@ -15,15 +15,14 @@
|
||||
// along with Parity Ethereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
//! Hasher implementation for the Keccak-256 hash
|
||||
extern crate hash_db;
|
||||
extern crate ethereum_types;
|
||||
extern crate tiny_keccak;
|
||||
extern crate plain_hasher;
|
||||
|
||||
#![warn(missing_docs)]
|
||||
|
||||
use hash_db::Hasher;
|
||||
use ethereum_types::H256;
|
||||
use tiny_keccak::Keccak;
|
||||
use plain_hasher::PlainHasher;
|
||||
|
||||
/// Concrete `Hasher` impl for the Keccak-256 hash
|
||||
#[derive(Default, Debug, Clone, PartialEq)]
|
||||
pub struct KeccakHasher;
|
||||
@ -32,7 +31,7 @@ impl Hasher for KeccakHasher {
|
||||
type StdHasher = PlainHasher;
|
||||
const LENGTH: usize = 32;
|
||||
fn hash(x: &[u8]) -> Self::Out {
|
||||
let mut out = [0;32];
|
||||
let mut out = [0; 32];
|
||||
Keccak::keccak256(x, &mut out);
|
||||
out.into()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user