Reed-Solomon encoding and decoding, in C++ and Javascript