more jslint cleanup; added license clause; removed old files
This commit is contained in:
1 parent
5fd0c7dcea
commit
ac903c654d
6 files changed
+39
-155
No files matched your search
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* passy.js - implementation of passy algorithm javascript, by Stephen Waits
|
||||
* sha1.js - implementation of SHA-1 hash and HMAC algorithms in javascript, by Stephen Waits
|
||||
*
|
||||
* The MIT License
|
||||
*
|
||||
@@ -24,6 +24,8 @@
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/*jslint onevar: true, undef: true, nomen: true, regexp: true, newcap: true, immed: true */
|
||||
|
||||
/*
|
||||
* Given a "text" (i.e. "amazon.com") and a "secret" (i.e. "mypassword") return an
|
||||
* array of four Passy'fied passwords.
|
||||
@@ -39,12 +41,15 @@ var passy = function(text,secret)
|
||||
*/
|
||||
var passify = function(hexstr)
|
||||
{
|
||||
// lookup table to convert a single character to a symbol
|
||||
var symtab = { "1":"!", "2":"@", "3":"#", "4":"$", "5":"%", "6":"^", "7":"&", "8":"*", "9":"(", "0":")" };
|
||||
var
|
||||
// lookup table to convert a single character to a symbol
|
||||
symtab = { "1":"!", "2":"@", "3":"#", "4":"$", "5":"%", "6":"^", "7":"&", "8":"*", "9":"(", "0":")" },
|
||||
|
||||
// misc
|
||||
odd = true, i;
|
||||
|
||||
// convert every other numerical character to a symbol
|
||||
var odd = true;
|
||||
for(var i=0;i<hexstr.length;++i)
|
||||
for(i=0;i<hexstr.length;++i)
|
||||
{
|
||||
// is this a digit-character?
|
||||
if ( /[0-9]/.test(hexstr[i]) )
|
||||
@@ -62,7 +67,7 @@ var passy = function(text,secret)
|
||||
|
||||
// alternate uppercase/lowercase for alpha characters
|
||||
odd = true;
|
||||
for(var i=0;i<hexstr.length;++i)
|
||||
for(i=0;i<hexstr.length;++i)
|
||||
{
|
||||
// is this an alpha-character?
|
||||
if ( /[a-f]/i.test(hexstr[i]) )
|
||||
@@ -80,7 +85,7 @@ var passy = function(text,secret)
|
||||
|
||||
// finished
|
||||
return hexstr;
|
||||
}
|
||||
};
|
||||
|
||||
// get hmac
|
||||
var hmac = SHA1.hmac(secret,text);
|
||||
@@ -96,4 +101,4 @@ var passy = function(text,secret)
|
||||
hmac.slice(10,20),
|
||||
hmac.slice(20,30),
|
||||
hmac.slice(30,40)];
|
||||
}
|
||||
};
|
||||
Reference in new issue
Block a user