>>886885
>race conditions
At least when you are running into race conditions, you might notice your program behaving wrong. With a poor cryptographic implementation, it might be built to spec, but is vulnerable to an attack.
I would rather encourage actually learning some cryptography before trying to implement something. For example, if the OP just used AES to encrypt 16 bytes (128 bits), it would be bad. You can just do the inverse of AES to recover those 16 bytes.