Simple password encryption / decryption
What I'd like from you guys, is pretty much to judge the system, and maybe if someone will, post an estimate as to how hard this system would be to crack


For a professional cryptographer (which I am not), it would be very easy to crack, due to the following factors:


the system relies on rand (rand is not really safe for cryptographic code; consider using a mersene twister, like mt19937).
the algorithm has low entropy, meaning it is easy to brute-force it, using a password dictionary.
considering your decryption algorithm is deducing the key from the data itself, a hacker could do the same.


There are probably other factors making the code easy to crack, but as I said, I am not a crptographer.


  (given that the special characters will be random), and if there are more efficient ways to go about making this system more secure. (I might decided to encrypt usernames as well). 


You are looking at a problem with a "yes/no" answer (i.e. you need to check that the data is the same, not use decrpyted data in more complex computations), you should consider a one-way hash.

The idea is to construct an ireversible function, (irreversible = "given x, f(x) is easy to compute, but given f(x) it is difficult/impossible to compute x").

Using a one-way function in your case:

To encode the password, you apply the function.

To check the password, you ask for user input, you apply the function on the input, then compare the result with the already computed value (the one you need to verify).

This will (theoretically) allow you to make an algorithm that is not required to be reversible for checking the data.

As a rule of thumb though, security code is notoriously hard to get right. Consider:


using third party solutions (like CryptoPP or OpenSSL)
using known solutions (OpenSSL, PGP/GPG)
implementing known cryptographic algorithms (look up symetric encryption, asymetric encryption, commercial hash functions and algorithms)