I believe openssl crypto module (http://www.openssl.org/docs/crypto/crypto.html) implements all you need. It is written in C, not CPP, but I believe you can easily warp it in a class, if you need some OOP feature.
Also, are you set in stone for this method?
The method I am using is (register):
1) Generate a random number.
2) Decrypt the password received by the client
3) Calculate a hash using the password and the random number
4) Save on the DB the random number (step 1) and the hash (step 3).
1) Decrypt the password received by the client
2) Calculate the hash using the random number saved on database.
3) Check if saved hash match with the one I just calculated.