Gossamer Forum
Home : Products : Others : Gossamer Community :

Encrypt/Decrypt User passwords

Quote Reply
Encrypt/Decrypt User passwords
Hi there,

I am currently working on creating a plugin which integrates Facebook Connect with GCommunity. Everything is set up and the plugin works great. From registration, through linking an existing account to automatically loggin in the user with FB Connect.

In this process I use a table which contains the user's Facebook ID, GCommunity Username and Unencrypted password. Yip, Unencrypted. Thing is, I need the unencrypted password to automatically log the user into GCommunity. But keeping unencrypted passwords in the database is a big no-no.
Is there a way for me to encrypt those passwords, and then, when needed, decrypt them to log the user in?

Regards,
EZFrag


Sacrifice is not about what you lose,
it is about what you gain in the process.
Quote Reply
Re: [EZFrag] Encrypt/Decrypt User passwords In reply to
Hi,

You could try doing it with base64 encoding:

Code:
use MIME::Base64 ();
$encoded = MIME::Base64::encode($decoded);
$decoded = MIME::Base64::decode($encoded);

..so basically encode it in base64 *before* putting into the DB - and then just decode it when you need it.

Hope that helps

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Encrypt/Decrypt User passwords In reply to
Thanks Andy. That worked 100%


Sacrifice is not about what you lose,
it is about what you gain in the process.