Author here.
Thanks for pointing out the security issue! I'm a novice in cryptography, and the encryption used in this program was just an idea I came up with.
I'm going to learn a bit more, but if you have any good ideas for improvements, could you let me know?
Cryptography is tricky to get right. There are a ton of subtle ways things can go wrong! I think the first thing to realize is your problem has probably been solved by someone else, so you can use off-the-shelf solutions. TLS has a pre-shared symmetric key option: https://en.wikipedia.org/wiki/TLS-PSK for example.
Second, I think it's important to know how crypto fails in order to use it properly. https://www.cryptopals.com has a bunch of challenges that walk you through breaking a crypto implementation.