Example above shows sha256 trapdoor function which accepts char pointer for the inputted data but instead the type should be pointer to the const char eg.: sha256( const char* data, ...). Is there any particular reason why it shouldn't be const? The problem is that you always have to const_cast the const references or pointers to constant. This adds unnecessary overhead for the programmer.
The type of data param of crypto_api::encode<T> which I assume is the function called from hash api functions should be also updated to the const char*. No reason to have char pointer there at least I don't see one.
https://github.com/EOSIO/eos/blob/75635168e743c3e65bb6345a1eaedd905581e6b0/contracts/eosiolib/crypto.h#L137
Example above shows
sha256
trapdoor function which accepts char pointer for the inputted data but instead the type should be pointer to the const char eg.:sha256( const char* data, ...)
. Is there any particular reason why it shouldn't be const? The problem is that you always have toconst_cast
the const references or pointers to constant. This adds unnecessary overhead for the programmer.The type of data param of
crypto_api::encode<T>
which I assume is the function called from hash api functions should be also updated to theconst char*
. No reason to have char pointer there at least I don't see one.https://github.com/EOSIO/eos/blob/75635168e743c3e65bb6345a1eaedd905581e6b0/libraries/chain/wasm_interface.cpp#L730