【发布时间】:2021-12-30 17:34:50
【问题描述】:
在基板中,我有一个获取哈希的代码:
let kitty = Kitty::<T> {
dna: String::from("test"),
price: None,
gender: String::from("male"),
owner: "there's an accountid here",
};
let kitty_id = T::Hashing::hash_of(&kitty);
如果将相同的 kitty 属性传递给 hash_of 函数,我能否得到相同的 kitty_id 哈希?
【问题讨论】:
-
您是在托盘中还是在哪里调用它?除非您知道自己在做什么,否则使用非随机输入调用散列函数通常是不安全的。
-
是的,谢谢,我找到了答案,因为 kitty.dna 是从随机结果中获得的,所以这将是一个随机哈希。否则,这是可以预测的
标签: substrate