Open brunorijsman opened 4 years ago
Hi @brunorijsman! If you have the time to fix the issue and open a PR that would be great :)
Same here (as in #58): I will take a shot at fixing the issues, cleaning up the code, and getting to better performance in the process. Expect pull request to review, hopefully within the next week or two.
Say Alice calls sendClassical with msg = b'01' (= two bytes, first character 0 = ASCII 48, second character 1 = ASCII 49).
When Bob calls recvClassical it receives a different msg = b'\x01' (= one byte, value 1).
This is because of the following piece of code:
You can see that:
The better approach would be something along the lines of:
And even that is not ideal, because there are still corner cases where the receiver gets something different than the sender sent.
A better option could be to use pickle to serialize messages on-the-wire.
I know it is "not safe" to unpickle messages received on-the-wire from an untrusted source, but it's probably good enough for simulations.
The pickling and unpickling could be done inside sendClassical and recvClassical, or the burden could be put on the application and sendClassical and recvClassical could insist on only getting messages of type bytes.
The former is more convenient for the application, the latter gives the application their own choice of serialization method (including the option of using something more safe than pickle).
@AckslD Feel free to assign to me. I can fix the issue and generate a pull request.