You can hash the secret before inserting it into your database. When you want to compare the users secret with yours, use the same hash algorithm to hash the users secret and compare this hash with the hash saved in your database.
$hashed_secret = hash_hmac('sha512', $secret, 'randon string');
You will need to use the same 'random string' every time. Use a rondom string of characters and symbols of a decent length of maybe 50 characters.