aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDeterminant <[email protected]>2019-06-11 00:03:23 -0400
committerDeterminant <[email protected]>2019-06-11 00:03:23 -0400
commit05ffb2ce9f4a0cbaca05a1d46b040743d661ce25 (patch)
tree9f13671da0eed9f2c387ec93ff019417f3807b40
parent299d1a3cf7f7ab2465dccc87dde578044c9b040b (diff)
...
-rw-r--r--include/salticidae/stream.h2
-rw-r--r--src/stream.cpp8
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