diff options
-rw-r--r-- | include/salticidae/stream.h | 2 | ||||
-rw-r--r-- | src/stream.cpp | 8 |
2 files changed, 10 insertions, 0 deletions
diff --git a/include/salticidae/stream.h b/include/salticidae/stream.h index 8f0c5b4..843fba6 100644 --- a/include/salticidae/stream.h +++ b/include/salticidae/stream.h @@ -537,6 +537,8 @@ const uint8_t *datastream_get_data_inplace(datastream_t *self, size_t len); uint256_t *datastream_get_hash(const datastream_t *self); bytearray_t *bytearray_new_moved_from_datastream(datastream_t *_moved_self); +char *datastream_get_hex(datastream_t *self); + #ifdef __cplusplus } #endif diff --git a/src/stream.cpp b/src/stream.cpp index 9ad41aa..3e24292 100644 --- a/src/stream.cpp +++ b/src/stream.cpp @@ -83,6 +83,14 @@ bytearray_t *bytearray_new_moved_from_datastream(datastream_t *_moved_src) { return res; } +char *datastream_get_hex(datastream_t *self) { + std::string tmp = self->get_hex(); + auto res = (char *)malloc(tmp.length() + 1); + memmove(res, tmp.c_str(), tmp.length()); + res[tmp.length()] = 0; + return res; +} + } #endif |