1. This is not increasing security.
2. Why is salt calculated all the time, even when not used ? (it could be moved down into the "if" statement).