I want to hash string using sha256 and then store it inside of my ink smart contract.
I tested this code in Rust and it works out for me:
use crypto::sha2::Sha256; use crypto::digest::Digest; let phrase = "purchase hobby popular celery evil fantasy someone party position gossip host gather"; let mut seed = Sha256::new(); seed.input_str(&phrase); let mut bytes = vec![0; seed.output_bytes()];
However, this code doesn't compile in ink, because ink can't seem to use crypto crate...
How can I use keccak256 inside of an ink smart contract to return me Vec ?
I found package Sha2x256, but I'm unsure how I should use this?