The following is the exact script I've used to get sums of passwords. Login names can be done the same way. The sums are stored either in 2 arrays then, or in an array of objects with the login sum as one property and the password sum as the other, on the HTML page or Javascript. This array can be listed on the page without showing the password or login names. The only thing that can break this algorithm is brute force, though with some experimentation and understanding of the code, certain ranges of passwords can be ruled out. The longer the string used, the more difficult it would be to crack with brute force, too.
The same function can be used, with the string value sent as a parameter to the function, and then compared to the list of allowed numbers generated. Strings are case sensitive here, and any keyboard character.
I saw a similar algorithm on a Javascript download site (like Javascript.com, or one of the others) a couple years ago that listed it as unbreakable and rated highly, but it was limted to alphanumeric characters only. I've used a similar algorithm for a long time for validating passwords and storing login names, and in 17 bytes store login name, password, and access level information for each user.
<script language="javascript">
function doencrypt()
{
var onepass=document.password.clear.value;
var passSum=0, mult=1;
for (var pi=0;pi<onepass.length;pi++)
{
var onenumber=onepass.charCodeAt(pi);
passSum += onenumber * mult;
mult *= 3;
}
document.password.encrypted.value = passSum;
}
</script>
This function would be used to check passwords against the numbers on the list on the login page.
<script language="javascript">
//these numbers were generated from passwords from the previous function
var passarray = new Array(1234, 7465, 98674);
function checkencrypt(onestring)
{
var onepass=onestring;
var passSum=0, mult=1;
for (var pi=0;pi<onepass.length;pi++)
{
var onenumber=onepass.charCodeAt(pi);
passSum += onenumber * mult;
mult *= 3;
}
for (var pi=0;pi<passarray.length;pi++)
{
if (passSum == passarray[pi]) return true;
}
return false;
}
</script>