i have two functions in which i calculate the checksume of a string. The first Problem is, i can change numa and numb as i want i always get the same checksume. It is as the string is not used. The second problem is with the same string in somefunction1 i get a different checksum in somefunction2.
test::somefunction1(uint8_t numa, uint8_t numb, uint64_t rndn){
/*
some calculation with numa and numb
*/
std::string data = ""+std::to_string(numa)+std::to_string(numb)+std::to_string(rndn);
checksum256 hash;
sha256((char*)&data, data.size(), &hash);
auto itr= tb_test.find(some_id);
tb_test.modify(itr, _self, [&](auto& f) {
f.hashvalue1 = hash;
f.data1s = data;
});
}
test::somefunction2(uint8_t numa, uint8_t numb, uint64_t rndn){
/*
some calculation with numa and numb
*/
std::string data = ""+std::to_string(numa)+std::to_string(numb)+std::to_string(rndn);
checksum256 hash;
sha256((char*)&data, data.size(), &hash);
auto itr= tb_test.find(some_id);
tb_test.modify(itr, _self, [&](auto& f) {
f.hashvalue2 = hash;
f.data2s = data;
});
}