oxen-pyoxenmq/src/bencode.cpp
Jason Rhinelander a98722a7da pyoxenmq overhaul
- Wrap much more of the OxenMQ
- Add extensive pydoc to everything
- Switch setup.py to pybind's built-in tools
2021-10-21 22:23:02 -03:00

16 lines
333 B
C++

#include "common.hpp"
#include "oxenmq/base32z.h"
namespace oxenmq {
void BEncode_Init(py::module& mod) {
mod.def("base32z_encode", [](py::bytes data) {
char* ptr = nullptr;
py::ssize_t sz = 0;
PyBytes_AsStringAndSize(data.ptr(), &ptr, &sz);
return oxenmq::to_base32z(ptr, ptr+sz);
});
}
}