code-hasher

Crates.iocode-hasher
lib.rscode-hasher
version0.1.0
sourcesrc
created_at2021-05-04 13:38:30.457709
updated_at2021-05-04 13:38:30.457709
descriptionTiny macro which generates associated constants based on the associated item content
homepage
repositoryhttps://github.com/dusk-network/rusk
max_upload_size
id393014
size24,193
Dusk Network (dusknetwork)

documentation

README

Build Status Repository Documentation

code-hasher

Tiny proc macro library designed to hash a code block generating a unique identifier for it which will get written into a const inside of the code block.

Example

#[code_hasher::hash(SOME_CONST_NAME, version = "0.1.0")]
pub mod testing_module {
    pub fn this_does_something() -> [u8; 32] {
        SOME_CONST_NAME
    }
}

Here, SOME_CONST_NAME has assigned as value the resulting hash of:

  • The code contained inside testing_module.

  • The version passed by the user (is optional). Not adding it will basically not hash this attribute and WILL NOT use any default alternatives.

Licensing

This code is licensed under Mozilla Public License Version 2.0 (MPL-2.0). Please see LICENSE for further info.

Commit count: 3846

cargo fmt