From 693d0b815ed3eb0920545475cfbb93436bc4d9a3 Mon Sep 17 00:00:00 2001 From: Stephen Waits Date: Fri, 12 Nov 2010 15:24:16 -0800 Subject: [PATCH] minor updates and compression * add password auto-clearing after 60s * display blank password if either site or password is blank * switch to sha1 * add license info to passy.js * created passytiny.js and passytiny.html (which includes passytiny.js already) --- passy.html | 28 +++++++++++++++++++++--- passy.js | 39 +++++++++++++++++++++++++++++++++ passytiny.html | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++ passytiny.js | 9 ++++++++ 4 files changed, 132 insertions(+), 3 deletions(-) create mode 100644 passytiny.html create mode 100644 passytiny.js diff --git a/passy.html b/passy.html index 3a3ab25..9b8a5f8 100644 --- a/passy.html +++ b/passy.html @@ -1,13 +1,35 @@ - - + diff --git a/passy.js b/passy.js index 529dc0f..e43b141 100644 --- a/passy.js +++ b/passy.js @@ -1,3 +1,42 @@ +/* A JavaScript implementation of the SHA family of hashes, as defined in FIPS + * PUB 180-2 as well as the corresponding HMAC implementation as defined in + * FIPS PUB 198a + * + * Version 1.3 Copyright Brian Turek 2008-2010 + * Distributed under the BSD License + * See http://jssha.sourceforge.net/ for more information + * + * Several functions taken from Paul Johnson + */ +(function(){var charSize=8,b64pad="",hexCase=0,str2binb=function(a){var b=[],mask=(1<>5]|=(a.charCodeAt(i/charSize)&mask)<<(32-charSize-(i%32))}return b},hex2binb=function(a){var b=[],length=a.length,i,num;for(i=0;i>3]|=num<<(24-(4*(i%8)))}else{return"INVALID HEX STRING"}}return b},binb2hex=function(a){var b=(hexCase)?"0123456789ABCDEF":"0123456789abcdef",str="",length=a.length*4,i,srcByte;for(i=0;i>2]>>((3-(i%4))*8);str+=b.charAt((srcByte>>4)&0xF)+b.charAt(srcByte&0xF)}return str},binb2b64=function(a){var b="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"+"0123456789+/",str="",length=a.length*4,i,j,triplet;for(i=0;i>2]>>8*(3-i%4))&0xFF)<<16)|(((a[i+1>>2]>>8*(3-(i+1)%4))&0xFF)<<8)|((a[i+2>>2]>>8*(3-(i+2)%4))&0xFF);for(j=0;j<4;j+=1){if(i*8+j*6<=a.length*32){str+=b.charAt((triplet>>6*(3-j))&0x3F)}else{str+=b64pad}}}return str},rotl=function(x,n){return(x<>>(32-n))},parity=function(x,y,z){return x^y^z},ch=function(x,y,z){return(x&y)^(~x&z)},maj=function(x,y,z){return(x&y)^(x&z)^(y&z)},safeAdd_2=function(x,y){var a=(x&0xFFFF)+(y&0xFFFF),msw=(x>>>16)+(y>>>16)+(a>>>16);return((msw&0xFFFF)<<16)|(a&0xFFFF)},safeAdd_5=function(a,b,c,d,e){var f=(a&0xFFFF)+(b&0xFFFF)+(c&0xFFFF)+(d&0xFFFF)+(e&0xFFFF),msw=(a>>>16)+(b>>>16)+(c>>>16)+(d>>>16)+(e>>>16)+(f>>>16);return((msw&0xFFFF)<<16)|(f&0xFFFF)},coreSHA1=function(f,g){var W=[],a,b,c,d,e,T,i,t,appendedMessageLength,H=[0x67452301,0xefcdab89,0x98badcfe,0x10325476,0xc3d2e1f0],K=[0x5a827999,0x5a827999,0x5a827999,0x5a827999,0x5a827999,0x5a827999,0x5a827999,0x5a827999,0x5a827999,0x5a827999,0x5a827999,0x5a827999,0x5a827999,0x5a827999,0x5a827999,0x5a827999,0x5a827999,0x5a827999,0x5a827999,0x5a827999,0x6ed9eba1,0x6ed9eba1,0x6ed9eba1,0x6ed9eba1,0x6ed9eba1,0x6ed9eba1,0x6ed9eba1,0x6ed9eba1,0x6ed9eba1,0x6ed9eba1,0x6ed9eba1,0x6ed9eba1,0x6ed9eba1,0x6ed9eba1,0x6ed9eba1,0x6ed9eba1,0x6ed9eba1,0x6ed9eba1,0x6ed9eba1,0x6ed9eba1,0x8f1bbcdc,0x8f1bbcdc,0x8f1bbcdc,0x8f1bbcdc,0x8f1bbcdc,0x8f1bbcdc,0x8f1bbcdc,0x8f1bbcdc,0x8f1bbcdc,0x8f1bbcdc,0x8f1bbcdc,0x8f1bbcdc,0x8f1bbcdc,0x8f1bbcdc,0x8f1bbcdc,0x8f1bbcdc,0x8f1bbcdc,0x8f1bbcdc,0x8f1bbcdc,0x8f1bbcdc,0xca62c1d6,0xca62c1d6,0xca62c1d6,0xca62c1d6,0xca62c1d6,0xca62c1d6,0xca62c1d6,0xca62c1d6,0xca62c1d6,0xca62c1d6,0xca62c1d6,0xca62c1d6,0xca62c1d6,0xca62c1d6,0xca62c1d6,0xca62c1d6,0xca62c1d6,0xca62c1d6,0xca62c1d6,0xca62c1d6];f[g>>5]|=0x80<<(24-(g%32));f[(((g+65)>>9)<<4)+15]=g;appendedMessageLength=f.length;for(i=0;i(keyBinLen/8)){keyToUse[15]&=0xFFFFFF00}for(i=0;i<=15;i+=1){keyWithIPad[i]=keyToUse[i]^0x36363636;keyWithOPad[i]=keyToUse[i]^0x5C5C5C5C}retVal=coreSHA1(keyWithIPad.concat(this.strToHash),512+this.strBinLen);retVal=coreSHA1(keyWithOPad.concat(retVal),672);return(d(retVal))}};window.jsSHA=jsSHA}()); + + +/* + * passy.js - implementation of passy algorithm javascript, by Stephen Waits + * + * The MIT License + * + * Copyright (c) 2010 Stephen Waits + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + /* * Given a "text" (i.e. "amazon.com") and a "secret" (i.e. "mypassword") return an * array of four Passy'fied passwords. diff --git a/passytiny.html b/passytiny.html new file mode 100644 index 0000000..4e7e4f1 --- /dev/null +++ b/passytiny.html @@ -0,0 +1,59 @@ + + + + + + + + +
+ Site Name:
+
+ Secret Passphrase:
+
+
+ Site Password:
+ +
+ + diff --git a/passytiny.js b/passytiny.js new file mode 100644 index 0000000..03344cd --- /dev/null +++ b/passytiny.js @@ -0,0 +1,9 @@ +(function(){var q=function(a){var c=[],d=a.length*8,b;for(b=0;b>5]|=(a.charCodeAt(b/8)&255)<<24-b%32;return c},r=function(a){var c=[],d=a.length,b,e;for(b=0;b>3]|=e<<24-4*(b%8)}return c},m=function(a){var c="",d=a.length*4,b,e;for(b=0;b>2]>>(3-b%4)*8;c+="0123456789abcdef".charAt(e>>4&15)+"0123456789abcdef".charAt(e&15)}return c},n=function(a){var c="",d=a.length*4,b,e,j;for(b=0;b>2]>>8*(3-b%4)&255)<<16|(a[b+1>>2]>>8*(3-(b+1)%4)&255)<<8|a[b+2>>2]>>8*(3-(b+2)%4)&255;for(e=0;e<4;e+=1)c+=b*8+e*6<=a.length*32?"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(j>>6*(3-e)&63):""}return c},f=function(a,c){return a<>>32-c},o=function(a,c){var d=(a&65535)+(c&65535);return((a>>>16)+(c>>>16)+(d>>>16)&65535)<<16|d&65535},k=function(a,c,d,b,e){var j=(a&65535)+(c&65535)+(d&65535)+(b&65535)+(e&65535);return((a>>>16)+(c>>>16)+(d>>>16)+(b>>>16)+(e>>>16)+ +(j>>>16)&65535)<<16|j&65535},u=function(a,c){var d=[],b,e,j,l,p,v,s,g,w,h=[1732584193,4023233417,2562383102,271733878,3285377520],t=[1518500249,1518500249,1518500249,1518500249,1518500249,1518500249,1518500249,1518500249,1518500249,1518500249,1518500249,1518500249,1518500249,1518500249,1518500249,1518500249,1518500249,1518500249,1518500249,1518500249,1859775393,1859775393,1859775393,1859775393,1859775393,1859775393,1859775393,1859775393,1859775393,1859775393,1859775393,1859775393,1859775393,1859775393, +1859775393,1859775393,1859775393,1859775393,1859775393,1859775393,2400959708,2400959708,2400959708,2400959708,2400959708,2400959708,2400959708,2400959708,2400959708,2400959708,2400959708,2400959708,2400959708,2400959708,2400959708,2400959708,2400959708,2400959708,2400959708,2400959708,3395469782,3395469782,3395469782,3395469782,3395469782,3395469782,3395469782,3395469782,3395469782,3395469782,3395469782,3395469782,3395469782,3395469782,3395469782,3395469782,3395469782,3395469782,3395469782,3395469782]; +a[c>>5]|=128<<24-c%32;a[(c+65>>9<<4)+15]=c;w=a.length;for(s=0;sa/8)c[15]&=4294967040;for(a=0;a<=15;a+=1){b[a]=c[a]^909522486;e[a]=c[a]^1549556828}b=u(b.concat(this.strToHash),512+this.strBinLen);b=u(e.concat(b),672);return d(b)}};window.jsSHA=x})(); +var passy=function(q,r){var m=function(f){var o={"1":"!","2":"@","3":"#","4":"$","5":"%","6":"^","7":"&","8":"*","9":"(","0":")"},k=true;for(i=0;i