I did some more research on the settings part of Windows Vista gadgets and storing username/passwords in plain text in your settings is not a smart thing to do.
You can use the JavaScript code below to do basic encryption and decryption.
function encrypt( plainString )
{
if ( plainString == "" ) return "";
var xor_key = 2;
var result = "";
for( i = 0; i < plainString.length; ++i)
{
result += String.fromCharCode( xor_key ^ plainString.charCodeAt(i) );
}
return result;
}
function decrypt( encryptedString )
{
if ( encryptedString == "" ) return "";
var xor_key = 2;
var result;
for( i = 0; i < encryptedString.length; i++)
{
result += String.fromCharCode( xor_key ^ encryptedString.charCodeAt(i));
}
return result;
}
Read more background info here.