I had a look at your crypto code, and the usual advice would be not to roll out your own crypto. Of course, since we are here to learn, that does not apply, so instead here are a few pointers on things you might want to learn about:
- authenticated encryption
- key derivation functions
- secure hash algorithms
I found this pretty good and pretty accessible https://www.crypto101.io/
Good learning!