#[derive(LightHasherSha)]
{
// Attributes available to this derive:
#[hash]
#[skip]
}
Expand description
SHA256 variant of the LightHasher derive macro.
This derive macro automatically implements the DataHasher and ToByteArray traits
for structs, using SHA256 as the hashing algorithm instead of Poseidon.
ยงExample
use light_sdk_macros::LightHasherSha;
use borsh::{BorshSerialize, BorshDeserialize};
use solana_pubkey::Pubkey;
#[derive(LightHasherSha, BorshSerialize, BorshDeserialize)]
pub struct GameState {
pub player: Pubkey, // Will be hashed to 31 bytes
pub level: u32,
}