├── images
├── passwdmaker128.png
├── passwdmaker16.png
└── passwdmaker48.png
├── html
├── background.html
├── popup.html
└── options.html
├── javascript
├── content.js
├── securehash.js
├── passwordmaker
│ ├── sha1.js
│ ├── l33t.js
│ ├── sha256.js
│ ├── md4.js
│ ├── hashutils.js
│ ├── ripemd160.js
│ ├── md5.js
│ ├── md5_v6.js
│ └── aes.js
├── import.js
├── popup.js
├── profile.js
├── options.js
├── settings.js
├── jquery-ui.min.js
└── json2.js
├── manifest.json
├── README.markdown
├── css
├── popup.css
├── options.css
└── awesome-buttons.css
├── test
├── import.js
├── index.html
└── qunit.css
└── LICENSE
/images/passwdmaker128.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/adamghill/chrome-passwordmaker/master/images/passwdmaker128.png
--------------------------------------------------------------------------------
/images/passwdmaker16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/adamghill/chrome-passwordmaker/master/images/passwdmaker16.png
--------------------------------------------------------------------------------
/images/passwdmaker48.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/adamghill/chrome-passwordmaker/master/images/passwdmaker48.png
--------------------------------------------------------------------------------
/html/background.html:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/javascript/content.js:
--------------------------------------------------------------------------------
1 | chrome.extension.onRequest.addListener(function(request, sender, sendResponse) {
2 | if (request.password) {
3 | fillPasswords(request.password);
4 | } else if (request.hasPasswordField) {
5 | sendResponse({hasField: hasPasswordField()});
6 | }
7 | });
8 |
9 | function fillPasswords(password) {
10 | jQuery("input[type=password]").val(password);
11 | }
12 |
13 | function hasPasswordField() {
14 | fields = jQuery("input[type=password]");
15 |
16 | hasFields = false;
17 |
18 | if (fields && fields.length > 0) {
19 | hasFields = true;
20 | }
21 |
22 | return hasFields;
23 | }
--------------------------------------------------------------------------------
/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "PasswordMaker Pro",
3 | "version": "0.1.12",
4 | "description": "A chrome extension based on passwordmaker.org . Create unique passwords for every webpage using a hashing algorythm.",
5 | "icons": {
6 | "16": "images/passwdmaker16.png",
7 | "48": "images/passwdmaker48.png",
8 | "128":"images/passwdmaker128.png"
9 | },
10 | "browser_action": {
11 | "default_icon": "images/passwdmaker48.png",
12 | "popup": "html/popup.html"
13 | },
14 | "permissions": [
15 | "tabs"
16 | ],
17 | "content_scripts": [ {
18 | "js": [ "javascript/jquery.min.js", "javascript/content.js" ],
19 | "matches": [ "http://*/*", "https://*/*" ]
20 | } ],
21 | "background_page": "html/background.html",
22 | "options_page": "html/options.html"
23 | }
24 |
--------------------------------------------------------------------------------
/javascript/securehash.js:
--------------------------------------------------------------------------------
1 | if (typeof(ChromePasswordMaker_SecureHash) != "object") {
2 | var ChromePasswordMaker_SecureHash = {
3 | seed: 'q#-f21@xNh9sJaKv6TLv8ipR%YgT&RnwMP4Zz2pMya&C44B137+wRkk7C08BF*b1',
4 | sha256_charset: 'FByDU98TAfzvkuaxgUH3HuMJ1jspdFu9',
5 | sha1_charset: '0cOJL6EsNlHFMWkbyPCU0EoBOZ80Ck2j',
6 | md5_charset: 'BPVB1oCrr2BJzhH6qM43kq9lLUqMQWxj',
7 | md4_charset: 'szPBOPb2WZwWCOYylDNb0kda4HPdp9I7',
8 |
9 | make_hash: function (text) {
10 | var hash = PasswordMaker_SHA256.any_sha256(text, Settings.masterPasswordCharSet);
11 | return this._hash(hash);
12 | },
13 |
14 | update_old_hash: function (oldhash) {
15 | return this._hash(oldhash);
16 | },
17 |
18 | _hash: function (hash) {
19 | for(var i = 0; i < 16; i++) {
20 | hash = PasswordMaker_SHA256.any_sha256(hash + this.seed, this.sha256_charset);
21 | hash = PasswordMaker_SHA1.any_sha1(hash + this.seed, this.sha1_charset);
22 | hash = PasswordMaker_MD5.any_md5(hash + this.seed, this.md5_charset);
23 | hash = PasswordMaker_MD4.any_md4(hash + this.seed, this.md4_charset);
24 | }
25 | hash = 'n' + hash.substring(1);
26 | return hash;
27 | }
28 | };
29 | }
--------------------------------------------------------------------------------
/README.markdown:
--------------------------------------------------------------------------------
1 | # Chrome PasswordMaker Pro
2 |
3 | 
4 |
5 | The only thing that kept me from switching to chrome completly was a missing port of the passwordmaker.org
6 | extension. Luckily there was one available in the extension directory .
7 | Sadly that extension is only a simple port of the html page that is offered on passwordmaker.org .
8 |
9 | This extension fixes this. It's a real port with all the bells and whistles you expect.
10 |
11 | # Installation
12 |
13 | You can install this plugin from the chrome extensions library .
14 |
15 | # Note on Patches/Pull Requests
16 |
17 | * Fork the project.
18 | * Make your feature addition or bug fix.
19 | * Commit, do not mess with version in manifest.json
20 | (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
21 | * Send me a pull request. Bonus points for topic branches.
22 |
23 | # Copyright
24 |
25 | Copyright (c) 2010 Bodo Tasche, PasswordMaker.org . See LICENSE for details. A list of all contributers can be found here .
--------------------------------------------------------------------------------
/css/popup.css:
--------------------------------------------------------------------------------
1 | body {
2 | width: 200px;
3 | height: 10px;
4 | font-family: sans-serif;
5 | font-size: 13px;
6 | }
7 |
8 | form {
9 | display:none;
10 | }
11 |
12 | label {
13 | font-family: Georgia, Palatino, Palatino Linotype, Times, Times New Roman, serif;
14 | font-size: 12px;
15 | font-weight: bold;
16 | color: #888888;
17 | }
18 |
19 | #head {
20 | font-family: Georgia, Palatino, Palatino Linotype, Times, Times New Roman, serif;
21 | border-bottom: 1px solid #eeeeee;
22 | margin-bottom: 5px;
23 | padding-bottom: 5px;
24 | vertical-align: middle;
25 | font-weight: bold;
26 | }
27 |
28 | #head img {
29 | position: absolute;
30 | top: 8px;
31 | }
32 |
33 | #head span {
34 | margin-left: 20px;
35 | }
36 |
37 | .input {
38 | margin: 0px;
39 | width: 200px;
40 | border: 1px solid #000000;
41 | }
42 |
43 | #generated{
44 | color: #5E80F0;
45 | font-weight: bold;
46 | text-align: center;
47 | width: 200px;
48 | border: 1px solid #000000;
49 | font-size:15px;
50 | }
51 |
52 | #generated{
53 | color: #5E80F0;
54 | font-style: italic;
55 | text-align: center;
56 | width: 200px;
57 | border: 1px solid #000000;
58 | font-size:15px;
59 | }
60 |
61 | select {
62 | margin: 0px;
63 | width: 200px;
64 | border: 1px solid #000000;
65 | }
66 |
67 | .row {
68 | margin-bottom: 5px;
69 | }
70 |
71 | #injectpasswordrow {
72 | float: left;
73 | }
74 |
75 | #options {
76 | float: right;
77 | }
78 |
79 | #button-row {
80 | margin-top: 5px;
81 | margin-bottom: 5px;
82 | }
83 |
84 | .largebutton {
85 | width: 180px;
86 | text-align: center;
87 | }
88 |
89 | #copypassword {
90 | float: left;
91 | }
92 |
93 | .hidden {
94 | margin-left: -500px;
95 | margin-top: -500px;
96 | }
97 |
--------------------------------------------------------------------------------
/test/import.js:
--------------------------------------------------------------------------------
1 | module("rdf import");
2 |
3 | var rdf_doc1 = RdfImporter.loadDoc($($('#rdf1').val()));
4 |
5 | test("parse global settings", function () {
6 | var s = rdf_doc1.settings;
7 |
8 | same(s.rdf_about, 'http://passwordmaker.mozdev.org/globalSettings');
9 | same(s.hideMasterPassword, false);
10 | same(s.storeLocation, 'memory');
11 | });
12 |
13 | test("find profiles", function () {
14 | same(rdf_doc1.profiles.length, 2);
15 | });
16 |
17 | test("load profile 1", function () {
18 | var p = rdf_doc1.profiles[0];
19 |
20 | same(p.rdf_about, 'rdf:#$5PGpU1');
21 | same(p.title,'nospecial');
22 | same(p.url_protocol, false);
23 | same(p.url_subdomain, false);
24 | same(p.url_domain, true);
25 | same(p.url_path, true);
26 | same(p.hashAlgorithm, 'hmac-sha256_fix');
27 | same(p.username, 'username1');
28 | same(p.modifier, 'modifier1');
29 | same(p.passwordLength, 20);
30 | same(p.selectedCharset, 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz');
31 | same(p.passwordPrefix, 'prefix1');
32 | same(p.passwordSuffix, 'suffix1');
33 | same(p.whereToUseL33t, 'before-hashing');
34 | same(p.l33tLevel, 1);
35 | });
36 |
37 | test("load profile 2", function () {
38 | var p = rdf_doc1.profiles[1];
39 |
40 | same(p.rdf_about, 'http://passwordmaker.mozdev.org/defaults');
41 | same(p.title,'Defaults');
42 | same(p.url_protocol, false);
43 | same(p.url_subdomain, false);
44 | same(p.url_domain, true);
45 | same(p.url_path, true);
46 | same(p.hashAlgorithm, 'sha256');
47 | same(p.username, 'username1');
48 | same(p.modifier, 'modifier1');
49 | same(p.passwordLength, 15);
50 | same(p.selectedCharset, 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789`~!@#$%');
51 | same(p.passwordPrefix, 'prefix1');
52 | same(p.passwordSuffix, 'suffix1');
53 | same(p.whereToUseL33t, 'off');
54 | same(p.l33tLevel, 1);
55 | });
56 |
57 | test("save profiles", function () {
58 | var profiles = rdf_doc1.profiles;
59 |
60 | same(profiles.length, 2);
61 | same(Settings.getProfiles().length, 1);
62 |
63 | RdfImporter.saveProfiles(profiles);
64 |
65 | same(Settings.getProfiles().length, 3);
66 | });
67 |
68 | test("save settings", function () {
69 | var settings = rdf_doc1.settings;
70 |
71 | Settings.setHidePassword(false);
72 | Settings.setStoreLocation('disk');
73 |
74 | same(Settings.shouldHidePassword(), false);
75 | same(Settings.storeLocation, 'disk');
76 |
77 | RdfImporter.saveSettings({hideMasterPassword: true, storeLocation: 'memory'});
78 |
79 | same(Settings.shouldHidePassword(), true);
80 | same(Settings.storeLocation, 'memory');
81 | });
82 |
--------------------------------------------------------------------------------
/html/popup.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
55 |
56 |
57 |
--------------------------------------------------------------------------------
/javascript/passwordmaker/sha1.js:
--------------------------------------------------------------------------------
1 | /*
2 | * A JavaScript implementation of the Secure Hash Algorithm, SHA-1, as defined
3 | * in FIPS PUB 180-1
4 | * Version 2.1 Copyright Paul Johnston 2000 - 2002.
5 | * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
6 | * Distributed under the BSD License
7 | * See http://pajhome.org.uk/crypt/md5 for details.
8 | *
9 | * Modified by Eric H. Jung (grimholtz@yahoo.com)
10 | */
11 |
12 | if (typeof(PasswordMaker_SHA1) != "object") {
13 | var PasswordMaker_SHA1 = {
14 |
15 | any_sha1 : function(s, e){ return PasswordMaker_HashUtils.rstr2any(this.rstr_sha1(PasswordMaker_HashUtils.str2rstr_utf8(s)), e); },
16 | any_hmac_sha1 : function(k, d, e){ return PasswordMaker_HashUtils.rstr2any(this.rstr_hmac_sha1(PasswordMaker_HashUtils.str2rstr_utf8(k), PasswordMaker_HashUtils.str2rstr_utf8(d)), e); },
17 |
18 | /*
19 | * Calculate the SHA1 of a raw string
20 | */
21 | rstr_sha1 : function(s) {
22 | return PasswordMaker_HashUtils.binb2rstr(this.binb_sha1(PasswordMaker_HashUtils.rstr2binb(s), s.length * PasswordMaker_HashUtils.chrsz));
23 | },
24 |
25 | /*
26 | * Calculate the SHA-1 of an array of big-endian words and a bit length
27 | */
28 | binb_sha1 : function(x, len) {
29 | /* append padding */
30 | x[len >> 5] |= 0x80 << (24 - len % 32);
31 | x[((len + 64 >> 9) << 4) + 15] = len;
32 |
33 | var w = Array(80);
34 | var a = 1732584193;
35 | var b = -271733879;
36 | var c = -1732584194;
37 | var d = 271733878;
38 | var e = -1009589776;
39 |
40 | for(var i = 0; i < x.length; i += 16) {
41 | var olda = a;
42 | var oldb = b;
43 | var oldc = c;
44 | var oldd = d;
45 | var olde = e;
46 |
47 | for(var j = 0; j < 80; j++) {
48 | if(j < 16) w[j] = x[i + j];
49 | else w[j] = PasswordMaker_HashUtils.bit_rol(w[j-3] ^ w[j-8] ^ w[j-14] ^ w[j-16], 1);
50 | var t = PasswordMaker_HashUtils.safe_add(PasswordMaker_HashUtils.safe_add(PasswordMaker_HashUtils.bit_rol(a, 5), this.sha1_ft(j, b, c, d)),
51 | PasswordMaker_HashUtils.safe_add(PasswordMaker_HashUtils.safe_add(e, w[j]), this.sha1_kt(j)));
52 | e = d;
53 | d = c;
54 | c = PasswordMaker_HashUtils.bit_rol(b, 30);
55 | b = a;
56 | a = t;
57 | }
58 |
59 | a = PasswordMaker_HashUtils.safe_add(a, olda);
60 | b = PasswordMaker_HashUtils.safe_add(b, oldb);
61 | c = PasswordMaker_HashUtils.safe_add(c, oldc);
62 | d = PasswordMaker_HashUtils.safe_add(d, oldd);
63 | e = PasswordMaker_HashUtils.safe_add(e, olde);
64 | }
65 | return Array(a, b, c, d, e);
66 |
67 | },
68 |
69 | /*
70 | * Perform the appropriate triplet combination function for the current
71 | * iteration
72 | */
73 | sha1_ft : function(t, b, c, d) {
74 | if(t < 20) return (b & c) | ((~b) & d);
75 | if(t < 40) return b ^ c ^ d;
76 | if(t < 60) return (b & c) | (b & d) | (c & d);
77 | return b ^ c ^ d;
78 | },
79 |
80 | /*
81 | * Determine the appropriate additive constant for the current iteration
82 | */
83 | sha1_kt : function(t) {
84 | return (t < 20) ? 1518500249 : (t < 40) ? 1859775393 :
85 | (t < 60) ? -1894007588 : -899497514;
86 | },
87 |
88 | /*
89 | * Calculate the HMAC-SHA1 of a key and some data (raw strings)
90 | */
91 | rstr_hmac_sha1 : function(key, data) {
92 | var bkey = PasswordMaker_HashUtils.rstr2binb(key);
93 | if(bkey.length > 16) bkey = this.binb_sha1(bkey, key.length * 8);
94 |
95 | var ipad = Array(16), opad = Array(16);
96 | for(var i = 0; i < 16; i++) {
97 | ipad[i] = bkey[i] ^ 0x36363636;
98 | opad[i] = bkey[i] ^ 0x5C5C5C5C;
99 | }
100 |
101 | var hash = this.binb_sha1(ipad.concat(PasswordMaker_HashUtils.rstr2binb(data)), 512 + data.length * 8);
102 | return PasswordMaker_HashUtils.binb2rstr(this.binb_sha1(opad.concat(hash), 512 + 160));
103 | }
104 | }
105 | }
106 |
--------------------------------------------------------------------------------
/javascript/passwordmaker/l33t.js:
--------------------------------------------------------------------------------
1 | /**
2 | PasswordMaker - Creates and manages passwords
3 | Copyright (C) 2005 Eric H. Jung and LeahScape, Inc.
4 | http://passwordmaker.org/
5 | grimholtz@yahoo.com
6 |
7 | This library is free software; you can redistribute it and/or modify it
8 | under the terms of the GNU Lesser General Public License as published by
9 | the Free Software Foundation; either version 2.1 of the License, or (at
10 | your option) any later version.
11 |
12 | This library is distributed in the hope that it will be useful, but WITHOUT
13 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 | FITNESSFOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
15 | for more details.
16 |
17 | You should have received a copy of the GNU Lesser General Public License
18 | along with this library; if not, write to the Free Software Foundation,
19 | Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 | **/
21 |
22 | /**************************************************
23 | * ECMAScript leetspeak - Version 1.0 by *
24 | * Eric H. Jung *
25 | * *
26 | * Ported from Oliver Gobin's *
27 | * PHP leetspeak - Version 1.0 *
28 | * http://www.ogobin.org/bin/scripts/31337.php.inc *
29 | * *
30 | * What is leetspeak? *
31 | * http://www.wikipedia.org/wiki/Leet *
32 | * http://www.heise.de/ct/00/11/003/ *
33 | ***************************************************/
34 |
35 | if (typeof(PasswordMaker_l33t) != "boolean") {
36 | var PasswordMaker_l33t = true;
37 | var PasswordMaker_l33t = {
38 | alphabet : new Array(/a/g, /b/g, /c/g, /d/g, /e/g, /f/g, /g/g, /h/g, /i/g, /j/g, /k/g, /l/g, /m/g, /n/g, /o/g, /p/g, /q/g, /r/g, /s/g, /t/g, /u/g, /v/g, /w/g, /x/g, /y/g, /z/g),
39 | levels : new Array(
40 | new Array("4", "b", "c", "d", "3", "f", "g", "h", "i", "j", "k", "1", "m", "n", "0", "p", "9", "r", "s", "7", "u", "v", "w", "x", "y", "z"),
41 | new Array("4", "b", "c", "d", "3", "f", "g", "h", "1", "j", "k", "1", "m", "n", "0", "p", "9", "r", "5", "7", "u", "v", "w", "x", "y", "2"),
42 | new Array("4", "8", "c", "d", "3", "f", "6", "h", "'", "j", "k", "1", "m", "n", "0", "p", "9", "r", "5", "7", "u", "v", "w", "x", "'/", "2"),
43 | new Array("@", "8", "c", "d", "3", "f", "6", "h", "'", "j", "k", "1", "m", "n", "0", "p", "9", "r", "5", "7", "u", "v", "w", "x", "'/", "2"),
44 | new Array("@", "|3", "c", "d", "3", "f", "6", "#", "!", "7", "|<", "1", "m", "n", "0", "|>", "9", "|2", "$", "7", "u", "\\/", "w", "x", "'/", "2"),
45 | new Array("@", "|3", "c", "|)", "&", "|=", "6", "#", "!", ",|", "|<", "1", "m", "n", "0", "|>", "9", "|2", "$", "7", "u", "\\/", "w", "x", "'/", "2"),
46 | new Array("@", "|3", "[", "|)", "&", "|=", "6", "#", "!", ",|", "|<", "1", "^^", "^/", "0", "|*", "9", "|2", "5", "7", "(_)", "\\/", "\\/\\/", "><", "'/", "2"),
47 | new Array("@", "8", "(", "|)", "&", "|=", "6", "|-|", "!", "_|", "|\(", "1", "|\\/|", "|\\|", "()", "|>", "(,)", "|2", "$", "|", "|_|", "\\/", "\\^/", ")(", "'/", "\"/_"),
48 | new Array("@", "8", "(", "|)", "&", "|=", "6", "|-|", "!", "_|", "|\{", "|_", "/\\/\\", "|\\|", "()", "|>", "(,)", "|2", "$", "|", "|_|", "\\/", "\\^/", ")(", "'/", "\"/_")),
49 |
50 | /**
51 | * Convert the string in _message_ to l33t-speak
52 | * using the l33t level specified by _leetLevel_.
53 | * l33t levels are 1-9 with 1 being the simplest
54 | * form of l33t-speak and 9 being the most complex.
55 | *
56 | * Note that _message_ is converted to lower-case if
57 | * the l33t conversion is performed.
58 | * Future versions can support mixed-case, if we need it.
59 | *
60 | * Using a _leetLevel_ <= 0 results in the original message
61 | * being returned.
62 | *
63 | */
64 | convert : function(leetLevel, message) {
65 | if (leetLevel > -1) {
66 | var ret = message.toLowerCase();
67 | for (var item = 0; item < this.alphabet.length; item++)
68 | ret = ret.replace(this.alphabet[item], this.levels[leetLevel][item]);
69 | return ret;
70 | }
71 | return message;
72 | }
73 | }
74 | }
--------------------------------------------------------------------------------
/css/options.css:
--------------------------------------------------------------------------------
1 | body {
2 | margin: 0px;
3 | }
4 |
5 | #content {
6 | width: 750px;
7 | margin-left: auto;
8 | margin-right: auto;
9 | }
10 |
11 | #header {
12 | border-bottom: 1px solid #aaaaaa;
13 | background-color: #eeeeee;
14 | margin-bottom: 10px;
15 | }
16 |
17 | #header h1 {
18 | margin-bottom: 0px;
19 | padding-top: 15px;
20 | padding-bottom: 15px;
21 | width: 750px;
22 | margin-left: auto;
23 | margin-right: auto;
24 | font-family: Georgia, Palatino, Palatino Linotype, Times, Times New Roman, serif;
25 | font-style: italic;
26 | }
27 |
28 | #list {
29 | padding: 5px;
30 | width: 210px;
31 | float: left;
32 | border-right: 1px solid #aaaaaa;
33 | }
34 |
35 | #list ul {
36 | padding-left: 10px;
37 | list-style-type: none;
38 | }
39 |
40 | #list li:before {
41 | content: "\0020 \0020 \0020 \00BB \0020";
42 | color: #aaaaaa;
43 | }
44 |
45 | #list .button {
46 | width: 120px;
47 | }
48 |
49 | h2 {
50 | font-family: Georgia, Palatino, Palatino Linotype, Times, Times New Roman, serif;
51 | }
52 |
53 | #profileNameTB {
54 | font-family: Georgia, Palatino, Palatino Linotype, Times, Times New Roman, serif;
55 | font-size: 2em;
56 | }
57 |
58 | .subrow {
59 | padding-top: 3px;
60 | }
61 |
62 | #showSettings {
63 | margin-top: 20px;
64 | }
65 |
66 | #showImport {
67 | margin-top: 20px;
68 | }
69 |
70 | #list h2 {
71 | padding-top: 0px;
72 | margin-top: 0px;
73 | }
74 |
75 | #profile_setting {
76 | padding: 5px;
77 | width: 505px;
78 | float: right;
79 | }
80 |
81 | #general_settings {
82 | padding: 5px;
83 | width: 505px;
84 | float: right;
85 | display: none;
86 | }
87 |
88 | #import_settings {
89 | padding: 5px;
90 | width: 505px;
91 | float: right;
92 | display: none;
93 | }
94 |
95 | #import_settings p {
96 | padding-left: 2px;
97 | }
98 |
99 | #importText {
100 | width: 505px;
101 | height: 150px;
102 | }
103 |
104 | #profile_setting h2 {
105 | padding-top: 0px;
106 | margin-top: 0px;
107 | }
108 |
109 | #buttons {
110 | margin-top: 20px;
111 | margin-left: 135px;
112 | width: 300px;
113 | }
114 |
115 | #buttons #remove {
116 | float: right;
117 | }
118 |
119 | #buttons #save {
120 | float: left;
121 | }
122 |
123 | #import_buttons {
124 | width: 505px;
125 | text-align: right;
126 | }
127 |
128 | .row {
129 | margin-bottom: 5px;
130 | }
131 |
132 | .secondColumn {
133 | margin-left: 135px;
134 | }
135 |
136 | label {
137 | position: absolute;
138 | text-align:right;
139 | width:130px;
140 | margin-top: 0.2em;
141 | }
142 |
143 | label.disabled {
144 | color: #aaaaaa;
145 | }
146 |
147 | label.checkbox {
148 | position: relative;
149 | }
150 |
151 | input[type="checkbox"] {
152 | width: 20px;
153 | }
154 |
155 | select {
156 | margin-left: 135px;
157 | width: 300px;
158 | }
159 |
160 | input {
161 | margin-left: 135px;
162 | width: 300px;
163 | }
164 |
165 | .url_example span.selected {
166 | color: #FFDB13;
167 | }
168 |
169 | .url_example {
170 | margin-left: 135px;
171 | width: 300px;
172 | text-align: center;
173 | background-color: #000000;
174 | border-radius: 7px !important;
175 | -moz-border-radius: 7px !important;
176 | -webkit-border-radius: 7px !important;
177 | margin-bottom: 10px;
178 | color: #ffffff;
179 | font-size: 12px;
180 | font-family: Georgia, Palatino, Palatino Linotype, Times, Times New Roman, serif;
181 | font-style: italic;
182 | padding-top: 10px;
183 | padding-bottom: 10px;
184 | }
185 |
186 | #pledgie {
187 | margin-top: 30px;
188 | }
189 |
190 | #footer {
191 | font-family: Georgia, Palatino, Palatino Linotype, Times, Times New Roman, serif;
192 | font-style: italic;
193 | font-size: 0.8em;
194 | margin-top: 30px;
195 | width: 100%;
196 | text-align: center;
197 | }
198 |
199 | #footer a {
200 | background-color: #dddddd;
201 | font-style: normal;
202 | color: #000000;
203 | padding: 4px;
204 | border-radius: 5px !important;
205 | -moz-border-radius: 5px !important;
206 | -webkit-border-radius: 5px !important;
207 | }
208 |
--------------------------------------------------------------------------------
/javascript/import.js:
--------------------------------------------------------------------------------
1 | function strToBool(v) {
2 | return v.toString() === 'true';
3 | }
4 |
5 | var RdfImporter = {
6 | attrMap: {
7 | about: {
8 | name: 'rdf_about',
9 | },
10 |
11 | // Settings
12 | // TODO? master password
13 | maskmasterpassword: {
14 | name: 'hideMasterPassword',
15 | convert: strToBool,
16 | },
17 | masterpasswordstorage: {
18 | name: 'storeLocation',
19 | convert: function (v) {
20 | return {'store-on-disk': 'disk', 'store-in-memory': 'memory'}[v];
21 | },
22 | },
23 |
24 | // Profiles
25 | name: {
26 | name: 'title',
27 | },
28 | whereleetlb: {
29 | name: 'whereToUseL33t',
30 | },
31 | leetlevellb: {
32 | name: 'l33tLevel',
33 | convert: parseInt,
34 | },
35 | hashalgorithmlb: {
36 | name: 'hashAlgorithm',
37 | convert: function (v) {
38 | // rest of the names are the same
39 | return {'hmac-sha256-fixed': 'hmac-sha256_fix',
40 | 'md5-v0.6': 'md5_v6',
41 | 'hmac-md5-v0.6': 'hmac-md5_v6'}[v] || v;
42 | },
43 | },
44 | passwordlength: {
45 | name: 'passwordLength',
46 | convert: parseInt,
47 | },
48 | usernametb: {
49 | name: 'username',
50 | },
51 | counter: {
52 | name: 'modifier',
53 | },
54 | charset: {
55 | name: 'selectedCharset',
56 | },
57 | prefix: {
58 | name: 'passwordPrefix',
59 | },
60 | suffix: {
61 | name: 'passwordSuffix',
62 | },
63 | protocolcb: {
64 | name: 'url_protocol',
65 | convert: strToBool,
66 | },
67 | subdomaincb: {
68 | name: 'url_subdomain',
69 | convert: strToBool,
70 | },
71 | domaincb: {
72 | name: 'url_domain',
73 | convert: strToBool,
74 | },
75 | pathcb: {
76 | name: 'url_path',
77 | convert: strToBool,
78 | },
79 | }
80 | }
81 |
82 | RdfImporter.loadDoc = function(rdf) {
83 | var profiles = [],
84 | defaultProfile = {},
85 | settings = {},
86 | that = this;
87 | // check over every Description, but will ignore groups and anything without
88 | // settings/profile attributes
89 | $(rdf).find('RDF\\:Description').each(function(){
90 | var prof = {};
91 | for(var i=0;i
3 |
4 |
5 | QUnit Test Suite
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
109 |
110 |
111 |
112 |
113 |
114 |
--------------------------------------------------------------------------------
/test/qunit.css:
--------------------------------------------------------------------------------
1 | /** Font Family and Sizes */
2 |
3 | #qunit-tests, #qunit-header, #qunit-banner, #qunit-testrunner-toolbar, #qunit-userAgent, #qunit-testresult {
4 | font-family: "Helvetica Neue Light", "HelveticaNeue-Light", "Helvetica Neue", Calibri, Helvetica, Arial;
5 | }
6 |
7 | #qunit-testrunner-toolbar, #qunit-userAgent, #qunit-testresult, #qunit-tests li { font-size: small; }
8 | #qunit-tests { font-size: smaller; }
9 |
10 |
11 | /** Resets */
12 |
13 | #qunit-tests, #qunit-tests ol, #qunit-header, #qunit-banner, #qunit-userAgent, #qunit-testresult {
14 | margin: 0;
15 | padding: 0;
16 | }
17 |
18 |
19 | /** Header */
20 |
21 | #qunit-header {
22 | padding: 0.5em 0 0.5em 1em;
23 |
24 | color: #8699a4;
25 | background-color: #0d3349;
26 |
27 | font-size: 1.5em;
28 | line-height: 1em;
29 | font-weight: normal;
30 |
31 | border-radius: 15px 15px 0 0;
32 | -moz-border-radius: 15px 15px 0 0;
33 | -webkit-border-top-right-radius: 15px;
34 | -webkit-border-top-left-radius: 15px;
35 | }
36 |
37 | #qunit-header a {
38 | text-decoration: none;
39 | color: #c2ccd1;
40 | }
41 |
42 | #qunit-header a:hover,
43 | #qunit-header a:focus {
44 | color: #fff;
45 | }
46 |
47 | #qunit-banner {
48 | height: 5px;
49 | }
50 |
51 | #qunit-testrunner-toolbar {
52 | padding: 0.5em 0 0.5em 2em;
53 | color: #5E740B;
54 | background-color: #eee;
55 | }
56 |
57 | #qunit-userAgent {
58 | padding: 0.5em 0 0.5em 2.5em;
59 | background-color: #2b81af;
60 | color: #fff;
61 | text-shadow: rgba(0, 0, 0, 0.5) 2px 2px 1px;
62 | }
63 |
64 |
65 | /** Tests: Pass/Fail */
66 |
67 | #qunit-tests {
68 | list-style-position: inside;
69 | }
70 |
71 | #qunit-tests li {
72 | padding: 0.4em 0.5em 0.4em 2.5em;
73 | border-bottom: 1px solid #fff;
74 | list-style-position: inside;
75 | }
76 |
77 | #qunit-tests.hidepass li.pass, #qunit-tests.hidepass li.running {
78 | display: none;
79 | }
80 |
81 | #qunit-tests li strong {
82 | cursor: pointer;
83 | }
84 |
85 | #qunit-tests li a {
86 | padding: 0.5em;
87 | color: #c2ccd1;
88 | text-decoration: none;
89 | }
90 | #qunit-tests li a:hover,
91 | #qunit-tests li a:focus {
92 | color: #000;
93 | }
94 |
95 | #qunit-tests ol {
96 | margin-top: 0.5em;
97 | padding: 0.5em;
98 |
99 | background-color: #fff;
100 |
101 | border-radius: 15px;
102 | -moz-border-radius: 15px;
103 | -webkit-border-radius: 15px;
104 |
105 | box-shadow: inset 0px 2px 13px #999;
106 | -moz-box-shadow: inset 0px 2px 13px #999;
107 | -webkit-box-shadow: inset 0px 2px 13px #999;
108 | }
109 |
110 | #qunit-tests table {
111 | border-collapse: collapse;
112 | margin-top: .2em;
113 | }
114 |
115 | #qunit-tests th {
116 | text-align: right;
117 | vertical-align: top;
118 | padding: 0 .5em 0 0;
119 | }
120 |
121 | #qunit-tests td {
122 | vertical-align: top;
123 | }
124 |
125 | #qunit-tests pre {
126 | margin: 0;
127 | white-space: pre-wrap;
128 | word-wrap: break-word;
129 | }
130 |
131 | #qunit-tests del {
132 | background-color: #e0f2be;
133 | color: #374e0c;
134 | text-decoration: none;
135 | }
136 |
137 | #qunit-tests ins {
138 | background-color: #ffcaca;
139 | color: #500;
140 | text-decoration: none;
141 | }
142 |
143 | /*** Test Counts */
144 |
145 | #qunit-tests b.counts { color: black; }
146 | #qunit-tests b.passed { color: #5E740B; }
147 | #qunit-tests b.failed { color: #710909; }
148 |
149 | #qunit-tests li li {
150 | margin: 0.5em;
151 | padding: 0.4em 0.5em 0.4em 0.5em;
152 | background-color: #fff;
153 | border-bottom: none;
154 | list-style-position: inside;
155 | }
156 |
157 | /*** Passing Styles */
158 |
159 | #qunit-tests li li.pass {
160 | color: #5E740B;
161 | background-color: #fff;
162 | border-left: 26px solid #C6E746;
163 | }
164 |
165 | #qunit-tests .pass { color: #528CE0; background-color: #D2E0E6; }
166 | #qunit-tests .pass .test-name { color: #366097; }
167 |
168 | #qunit-tests .pass .test-actual,
169 | #qunit-tests .pass .test-expected { color: #999999; }
170 |
171 | #qunit-banner.qunit-pass { background-color: #C6E746; }
172 |
173 | /*** Failing Styles */
174 |
175 | #qunit-tests li li.fail {
176 | color: #710909;
177 | background-color: #fff;
178 | border-left: 26px solid #EE5757;
179 | }
180 |
181 | #qunit-tests > li:last-child {
182 | border-radius: 0 0 15px 15px;
183 | -moz-border-radius: 0 0 15px 15px;
184 | -webkit-border-bottom-right-radius: 15px;
185 | -webkit-border-bottom-left-radius: 15px;
186 | }
187 |
188 | #qunit-tests .fail { color: #000000; background-color: #EE5757; }
189 | #qunit-tests .fail .test-name,
190 | #qunit-tests .fail .module-name { color: #000000; }
191 |
192 | #qunit-tests .fail .test-actual { color: #EE5757; }
193 | #qunit-tests .fail .test-expected { color: green; }
194 |
195 | #qunit-banner.qunit-fail { background-color: #EE5757; }
196 |
197 |
198 | /** Result */
199 |
200 | #qunit-testresult {
201 | padding: 0.5em 0.5em 0.5em 2.5em;
202 |
203 | color: #2b81af;
204 | background-color: #D2E0E6;
205 |
206 | border-bottom: 1px solid white;
207 | }
208 |
209 | /** Fixture */
210 |
211 | #qunit-fixture {
212 | position: absolute;
213 | top: -10000px;
214 | left: -10000px;
215 | }
216 |
--------------------------------------------------------------------------------
/javascript/popup.js:
--------------------------------------------------------------------------------
1 | var currentTab = null;
2 |
3 | function setPasswordColors(foreground, background) {
4 | $("#generated").css("background-color", background);
5 | $("#generated").css("color", foreground);
6 | $("#password").css("background-color", background);
7 | $("#password").css("color", foreground);
8 | $("#confirmation").css("background-color", background);
9 | $("#confirmation").css("color", foreground);
10 | }
11 |
12 | function updateFields(e) {
13 | var password = $("#password").val();
14 | var confirmation = $("#confirmation").val();
15 | var profileId = $("#profile").val();
16 | var profile = Settings.getProfile(profileId);
17 |
18 | Settings.setStoreLocation($("#store_location").val());
19 | Settings.setPassword(password);
20 | Settings.setActiveProfileId(profileId);
21 |
22 | if (password == "") {
23 | $("#generatedForClipboard").val("");
24 | $("#generated").val("Enter password");
25 | setPasswordColors("#000000", "#85FFAB")
26 | } else if ( ! matchesHash(password) ) {
27 | $("#generatedForClipboard").val("");
28 | $("#generated").val("Master password mismatch");
29 | setPasswordColors("#FFFFFF", "#FF7272")
30 | } else if (!Settings.keepMasterPasswordHash() && password != confirmation) {
31 | $("#generatedForClipboard").val("");
32 | $("#generated").val("Password wrong");
33 | setPasswordColors("#FFFFFF", "#FF7272")
34 | } else {
35 | if (profile != null) {
36 | var generatedPassword = profile.getPassword($("#usedtext").val(), password);
37 | $("#generated").val(generatedPassword);
38 | $("#generatedForClipboard").val(generatedPassword);
39 | showCopy();
40 | } else {
41 | $("#generated").val("");
42 | $("#generatedForClipboard").val("");
43 | }
44 | setPasswordColors("#000000", "#FFFFFF")
45 | // pressed enter in confirmation field
46 | if(e && e.keyCode == 13){
47 | chrome.tabs.sendRequest(currentTab, {hasPasswordField: true}, function(response) {
48 | if (response.hasField) {
49 | fillPassword();
50 | }
51 | });
52 | }
53 | }
54 | if (Settings.keepMasterPasswordHash()) {
55 | $("#confirmation_row").css('display', 'none');
56 | } else {
57 | $("#confirmation_row").css('display', 'block');
58 | }
59 | }
60 |
61 | function matchesHash(password) {
62 | if (!Settings.keepMasterPasswordHash()) return true;
63 | var saved_hash = Settings.masterPasswordHash();
64 | var new_hash = ChromePasswordMaker_SecureHash.make_hash(password);
65 | return new_hash == saved_hash ;
66 | }
67 |
68 | function updateUsedText(url) {
69 | var profile = Settings.getProfile($("#profile").val());
70 | $("#usedtext").val(profile.getUrl(url));
71 | }
72 |
73 | function fetchUrlAndUpdateUsedText() {
74 | chrome.windows.getCurrent(function(obj) {
75 | chrome.tabs.getSelected(obj.id, function(tab) {
76 | updateUsedText(tab.url);
77 | });
78 | });
79 | }
80 |
81 | function showInject() {
82 | $("#injectpasswordrow").fadeIn();
83 | }
84 |
85 | function showCopy() {
86 | $("#copypassword").fadeIn();
87 | }
88 |
89 | function init(url) {
90 | var profiles = Settings.getProfiles();
91 | Settings.getPassword(function(password) {
92 | $("#password").val(password);
93 | $("#confirmation").val(password);
94 |
95 | var options = "";
96 | for (var i in profiles) {
97 | var profile = profiles[i];
98 | options += ""+profile.title+" ";
103 | }
104 |
105 | $("#profile").empty().append(options);
106 |
107 | updateUsedText(url);
108 | $("#store_location").val(Settings.storeLocation);
109 |
110 | updateFields();
111 |
112 | chrome.tabs.sendRequest(currentTab, {hasPasswordField: true}, function(response) {
113 | if (response.hasField) {
114 | showInject();
115 | }
116 | });
117 |
118 | password = $("#password").val();
119 | if (password == null || password.length == 0 || (password != $("#confirmation").val())) {
120 | $("#password").focus();
121 | }
122 | });
123 | }
124 |
125 | function fillPassword() {
126 | chrome.tabs.sendRequest(currentTab, {password: $("#generated").val()});
127 | window.close();
128 | }
129 |
130 | function copyPassword() {
131 | $("#generatedForClipboard").select();
132 | document.execCommand("Copy");
133 | window.close();
134 | }
135 |
136 | function showPasswordField() {
137 | $("#activatePassword").hide();
138 | $("#generated").show();
139 | $("#generated").focus();
140 | }
141 |
142 | $(function() {
143 | $("#injectpasswordrow").hide();
144 | $("#copypassword").hide();
145 |
146 | if (Settings.shouldHidePassword()){
147 | $("#generated").hide();
148 | $("#activatePassword").show();
149 | } else {
150 | $("#generated").show();
151 | $("#generated").focus();
152 | $("#activatePassword").hide();
153 | }
154 |
155 | if (Settings.keepMasterPasswordHash()) {
156 | var saved_hash = Settings.masterPasswordHash();
157 | if(saved_hash.charAt(0) != 'n') {
158 | saved_hash = ChromePasswordMaker_SecureHash.update_old_hash(saved_hash);
159 | Settings.setMasterPasswordHash(saved_hash);
160 | }
161 | }
162 |
163 | chrome.windows.getCurrent(function(obj) {
164 | chrome.tabs.getSelected(obj.id, function(tab) {
165 | currentTab = tab.id;
166 | init(tab.url);
167 | $("form").show();
168 | });
169 | });
170 | });
171 |
--------------------------------------------------------------------------------
/javascript/passwordmaker/sha256.js:
--------------------------------------------------------------------------------
1 | /*
2 | * A JavaScript implementation of the Secure Hash Algorithm, SHA-256, as defined
3 | * in FIPS PUB XXXXXX
4 | * Version 2.2-alpha Copyright Angel Marin, Paul Johnston 2000 - 2005.
5 | * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
6 | * Distributed under the BSD License
7 | * See http://pajhome.org.uk/crypt/md5 for details.
8 | *
9 | * modified by Eric H. Jung (grimholtz@yahoo.com) - 2005
10 | *
11 | */
12 |
13 | if (typeof(PasswordMaker_SHA256) != "object") {
14 | var PasswordMaker_SHA256 = {
15 | any_sha256 : function(s, e){ return PasswordMaker_HashUtils.rstr2any(this.rstr_sha256(PasswordMaker_HashUtils.str2rstr_utf8(s)), e); },
16 | any_hmac_sha256: function(k, d, e, b){ return PasswordMaker_HashUtils.rstr2any(this.rstr_hmac_sha256(PasswordMaker_HashUtils.str2rstr_utf8(k), PasswordMaker_HashUtils.str2rstr_utf8(d), b), e); },
17 |
18 | /*
19 | * Calculate the sha256 of a raw string
20 | */
21 | rstr_sha256 : function(s) {
22 | return PasswordMaker_HashUtils.binb2rstr(this.binb_sha256(PasswordMaker_HashUtils.rstr2binb(s), s.length * 8));
23 | },
24 |
25 | /*
26 | * Calculate the HMAC-sha256 of a key and some data (raw strings)
27 | */
28 | rstr_hmac_sha256 : function(key, data, bug) {
29 | var bkey = PasswordMaker_HashUtils.rstr2binb(key);
30 | if(bkey.length > 16) bkey = this.binb_sha256(bkey, key.length * 8);
31 |
32 | var ipad = Array(16), opad = Array(16);
33 | for(var i = 0; i < 16; i++)
34 | {
35 | ipad[i] = bkey[i] ^ 0x36363636;
36 | opad[i] = bkey[i] ^ 0x5C5C5C5C;
37 | }
38 |
39 | var hash = this.binb_sha256(ipad.concat(PasswordMaker_HashUtils.rstr2binb(data)), 512 + data.length * 8);
40 | return PasswordMaker_HashUtils.binb2rstr(this.binb_sha256(opad.concat(hash), 512 + ((bug) ? 160 : 256)));
41 | },
42 |
43 | /*
44 | * Main sha256 function, with its support functions
45 | */
46 | S:function(X, n) {return ( X >>> n ) | (X << (32 - n));},
47 | R:function (X, n) {return ( X >>> n );},
48 | Ch:function(x, y, z) {return ((x & y) ^ ((~x) & z));},
49 | Maj:function(x, y, z) {return ((x & y) ^ (x & z) ^ (y & z));},
50 | Sigma0256:function(x) {return (this.S(x, 2) ^ this.S(x, 13) ^ this.S(x, 22));},
51 | Sigma1256:function(x) {return (this.S(x, 6) ^ this.S(x, 11) ^ this.S(x, 25));},
52 | Gamma0256:function(x) {return (this.S(x, 7) ^ this.S(x, 18) ^ this.R(x, 3));},
53 | Gamma1256:function(x) {return (this.S(x, 17) ^ this.S(x, 19) ^ this.R(x, 10));},
54 | Sigma0512:function(x) {return (this.S(x, 28) ^ this.S(x, 34) ^ this.S(x, 39));},
55 | Sigma1512:function(x) {return (this.S(x, 14) ^ this.S(x, 18) ^ this.S(x, 41));},
56 | Gamma0512:function(x) {return (this.S(x, 1) ^ this.S(x, 8) ^ this.R(x, 7));},
57 | Gamma1512:function(x) {return (this.S(x, 19) ^ this.S(x, 61) ^ this.R(x, 6));},
58 |
59 | sha256_K : new Array(
60 | 1116352408, 1899447441, -1245643825, -373957723, 961987163, 1508970993,
61 | -1841331548, -1424204075, -670586216, 310598401, 607225278, 1426881987,
62 | 1925078388, -2132889090, -1680079193, -1046744716, -459576895, -272742522,
63 | 264347078, 604807628, 770255983, 1249150122, 1555081692, 1996064986,
64 | -1740746414, -1473132947, -1341970488, -1084653625, -958395405, -710438585,
65 | 113926993, 338241895, 666307205, 773529912, 1294757372, 1396182291,
66 | 1695183700, 1986661051, -2117940946, -1838011259, -1564481375, -1474664885,
67 | -1035236496, -949202525, -778901479, -694614492, -200395387, 275423344,
68 | 430227734, 506948616, 659060556, 883997877, 958139571, 1322822218,
69 | 1537002063, 1747873779, 1955562222, 2024104815, -2067236844, -1933114872,
70 | -1866530822, -1538233109, -1090935817, -965641998
71 | ),
72 |
73 | binb_sha256 : function(m, l) {
74 | var HASH = new Array(1779033703, -1150833019, 1013904242, -1521486534,
75 | 1359893119, -1694144372, 528734635, 1541459225);
76 | var W = new Array(64);
77 | var a, b, c, d, e, f, g, h;
78 | var i, j, T1, T2;
79 |
80 | /* append padding */
81 | m[l >> 5] |= 0x80 << (24 - l % 32);
82 | m[((l + 64 >> 9) << 4) + 15] = l;
83 |
84 | for(i = 0; i < m.length; i += 16)
85 | {
86 | a = HASH[0];
87 | b = HASH[1];
88 | c = HASH[2];
89 | d = HASH[3];
90 | e = HASH[4];
91 | f = HASH[5];
92 | g = HASH[6];
93 | h = HASH[7];
94 |
95 | for(j = 0; j < 64; j++)
96 | {
97 | if (j < 16) W[j] = m[j + i];
98 | else W[j] = PasswordMaker_HashUtils.safe_add(PasswordMaker_HashUtils.safe_add(PasswordMaker_HashUtils.safe_add(this.Gamma1256(W[j - 2]), W[j - 7]),
99 | this.Gamma0256(W[j - 15])), W[j - 16]);
100 |
101 | T1 = PasswordMaker_HashUtils.safe_add(PasswordMaker_HashUtils.safe_add(PasswordMaker_HashUtils.safe_add(PasswordMaker_HashUtils.safe_add(h, this.Sigma1256(e)), this.Ch(e, f, g)),
102 | this.sha256_K[j]), W[j]);
103 | T2 = PasswordMaker_HashUtils.safe_add(this.Sigma0256(a), this.Maj(a, b, c));
104 | h = g;
105 | g = f;
106 | f = e;
107 | e = PasswordMaker_HashUtils.safe_add(d, T1);
108 | d = c;
109 | c = b;
110 | b = a;
111 | a = PasswordMaker_HashUtils.safe_add(T1, T2);
112 | }
113 |
114 | HASH[0] = PasswordMaker_HashUtils.safe_add(a, HASH[0]);
115 | HASH[1] = PasswordMaker_HashUtils.safe_add(b, HASH[1]);
116 | HASH[2] = PasswordMaker_HashUtils.safe_add(c, HASH[2]);
117 | HASH[3] = PasswordMaker_HashUtils.safe_add(d, HASH[3]);
118 | HASH[4] = PasswordMaker_HashUtils.safe_add(e, HASH[4]);
119 | HASH[5] = PasswordMaker_HashUtils.safe_add(f, HASH[5]);
120 | HASH[6] = PasswordMaker_HashUtils.safe_add(g, HASH[6]);
121 | HASH[7] = PasswordMaker_HashUtils.safe_add(h, HASH[7]);
122 | }
123 | return HASH;
124 | }
125 | }
126 | }
127 |
--------------------------------------------------------------------------------
/javascript/passwordmaker/md4.js:
--------------------------------------------------------------------------------
1 | /*
2 | * A JavaScript implementation of the RSA Data Security, Inc. MD4 Message
3 | * Digest Algorithm, as defined in RFC 1320.
4 | * Version 2.1 Copyright (C) Jerrad Pierce, Paul Johnston 1999 - 2002.
5 | * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
6 | * Distributed under the BSD License
7 | * See http://pajhome.org.uk/crypt/md5 for more info.
8 | *
9 | * Modified by Eric H. Jung (grimholtz@yahoo.com)
10 | */
11 |
12 | if (typeof(PasswordMaker_MD4) != "object") {
13 | var PasswordMaker_MD4 = {
14 |
15 | any_md4 : function(s, e) { return PasswordMaker_HashUtils.rstr2any(this.rstr_md4(PasswordMaker_HashUtils.str2rstr_utf8(s)), e); },
16 | any_hmac_md4 : function(k, d, e) { return PasswordMaker_HashUtils.rstr2any(this.rstr_hmac_md4(PasswordMaker_HashUtils.str2rstr_utf8(k), PasswordMaker_HashUtils.str2rstr_utf8(d)), e); },
17 |
18 | /*
19 | * Calculate the MD4 of a raw string
20 | */
21 | rstr_md4 : function(s) {
22 | return PasswordMaker_HashUtils.binl2rstr(this.binl_md4(PasswordMaker_HashUtils.rstr2binl(s), s.length * PasswordMaker_HashUtils.chrsz));
23 | },
24 |
25 | /*
26 | * Calculate the MD4 of an array of little-endian words, and a bit length
27 | */
28 | binl_md4 : function(x, len) {
29 | /* append padding */
30 | x[len >> 5] |= 0x80 << (len % 32);
31 | x[(((len + 64) >>> 9) << 4) + 14] = len;
32 |
33 | var a = 1732584193;
34 | var b = -271733879;
35 | var c = -1732584194;
36 | var d = 271733878;
37 |
38 | for(var i = 0; i < x.length; i += 16)
39 | {
40 | var olda = a;
41 | var oldb = b;
42 | var oldc = c;
43 | var oldd = d;
44 |
45 | a = this.md4_ff(a, b, c, d, x[i+ 0], 3 );
46 | d = this.md4_ff(d, a, b, c, x[i+ 1], 7 );
47 | c = this.md4_ff(c, d, a, b, x[i+ 2], 11);
48 | b = this.md4_ff(b, c, d, a, x[i+ 3], 19);
49 | a = this.md4_ff(a, b, c, d, x[i+ 4], 3 );
50 | d = this.md4_ff(d, a, b, c, x[i+ 5], 7 );
51 | c = this.md4_ff(c, d, a, b, x[i+ 6], 11);
52 | b = this.md4_ff(b, c, d, a, x[i+ 7], 19);
53 | a = this.md4_ff(a, b, c, d, x[i+ 8], 3 );
54 | d = this.md4_ff(d, a, b, c, x[i+ 9], 7 );
55 | c = this.md4_ff(c, d, a, b, x[i+10], 11);
56 | b = this.md4_ff(b, c, d, a, x[i+11], 19);
57 | a = this.md4_ff(a, b, c, d, x[i+12], 3 );
58 | d = this.md4_ff(d, a, b, c, x[i+13], 7 );
59 | c = this.md4_ff(c, d, a, b, x[i+14], 11);
60 | b = this.md4_ff(b, c, d, a, x[i+15], 19);
61 |
62 | a = this.md4_gg(a, b, c, d, x[i+ 0], 3 );
63 | d = this.md4_gg(d, a, b, c, x[i+ 4], 5 );
64 | c = this.md4_gg(c, d, a, b, x[i+ 8], 9 );
65 | b = this.md4_gg(b, c, d, a, x[i+12], 13);
66 | a = this.md4_gg(a, b, c, d, x[i+ 1], 3 );
67 | d = this.md4_gg(d, a, b, c, x[i+ 5], 5 );
68 | c = this.md4_gg(c, d, a, b, x[i+ 9], 9 );
69 | b = this.md4_gg(b, c, d, a, x[i+13], 13);
70 | a = this.md4_gg(a, b, c, d, x[i+ 2], 3 );
71 | d = this.md4_gg(d, a, b, c, x[i+ 6], 5 );
72 | c = this.md4_gg(c, d, a, b, x[i+10], 9 );
73 | b = this.md4_gg(b, c, d, a, x[i+14], 13);
74 | a = this.md4_gg(a, b, c, d, x[i+ 3], 3 );
75 | d = this.md4_gg(d, a, b, c, x[i+ 7], 5 );
76 | c = this.md4_gg(c, d, a, b, x[i+11], 9 );
77 | b = this.md4_gg(b, c, d, a, x[i+15], 13);
78 |
79 | a = this.md4_hh(a, b, c, d, x[i+ 0], 3 );
80 | d = this.md4_hh(d, a, b, c, x[i+ 8], 9 );
81 | c = this.md4_hh(c, d, a, b, x[i+ 4], 11);
82 | b = this.md4_hh(b, c, d, a, x[i+12], 15);
83 | a = this.md4_hh(a, b, c, d, x[i+ 2], 3 );
84 | d = this.md4_hh(d, a, b, c, x[i+10], 9 );
85 | c = this.md4_hh(c, d, a, b, x[i+ 6], 11);
86 | b = this.md4_hh(b, c, d, a, x[i+14], 15);
87 | a = this.md4_hh(a, b, c, d, x[i+ 1], 3 );
88 | d = this.md4_hh(d, a, b, c, x[i+ 9], 9 );
89 | c = this.md4_hh(c, d, a, b, x[i+ 5], 11);
90 | b = this.md4_hh(b, c, d, a, x[i+13], 15);
91 | a = this.md4_hh(a, b, c, d, x[i+ 3], 3 );
92 | d = this.md4_hh(d, a, b, c, x[i+11], 9 );
93 | c = this.md4_hh(c, d, a, b, x[i+ 7], 11);
94 | b = this.md4_hh(b, c, d, a, x[i+15], 15);
95 |
96 | a = PasswordMaker_HashUtils.safe_add(a, olda);
97 | b = PasswordMaker_HashUtils.safe_add(b, oldb);
98 | c = PasswordMaker_HashUtils.safe_add(c, oldc);
99 | d = PasswordMaker_HashUtils.safe_add(d, oldd);
100 |
101 | }
102 | return Array(a, b, c, d);
103 | },
104 |
105 | /*
106 | * These functions implement the basic operation for each round of the
107 | * algorithm.
108 | */
109 | md4_cmn : function(q, a, b, x, s, t) {
110 | return PasswordMaker_HashUtils.safe_add(PasswordMaker_HashUtils.bit_rol(PasswordMaker_HashUtils.safe_add(PasswordMaker_HashUtils.safe_add(a, q), PasswordMaker_HashUtils.safe_add(x, t)), s), b);
111 | },
112 | md4_ff : function(a, b, c, d, x, s) {
113 | return this.md4_cmn((b & c) | ((~b) & d), a, 0, x, s, 0);
114 | },
115 | md4_gg : function(a, b, c, d, x, s) {
116 | return this.md4_cmn((b & c) | (b & d) | (c & d), a, 0, x, s, 1518500249);
117 | },
118 | md4_hh : function(a, b, c, d, x, s) {
119 | return this.md4_cmn(b ^ c ^ d, a, 0, x, s, 1859775393);
120 | },
121 |
122 | /*
123 | * Calculate the HMAC-MD4 of a key and some data
124 | */
125 | rstr_hmac_md4 : function(key, data) {
126 | var bkey = PasswordMaker_HashUtils.rstr2binl(key);
127 | if(bkey.length > 16) bkey = this.binl_md4(bkey, key.length * PasswordMaker_HashUtils.chrsz);
128 |
129 | var ipad = Array(16), opad = Array(16);
130 | for(var i = 0; i < 16; i++) {
131 | ipad[i] = bkey[i] ^ 0x36363636;
132 | opad[i] = bkey[i] ^ 0x5C5C5C5C;
133 | }
134 |
135 | var hash = this.binl_md4(ipad.concat(PasswordMaker_HashUtils.rstr2binl(data)), 512 + data.length * PasswordMaker_HashUtils.chrsz);
136 | //return this.binl_md4(opad.concat(hash), 512 + 128);
137 | return PasswordMaker_HashUtils.binl2rstr(this.binl_md4(opad.concat(hash), 512 + 128));
138 | }
139 | }
140 | }
--------------------------------------------------------------------------------
/javascript/profile.js:
--------------------------------------------------------------------------------
1 | function Profile() {
2 | this.id = 1;
3 | this.title = "Default";
4 |
5 | // Settings for the URL generation
6 | this.url_protocol = false;
7 | this.url_subdomain = false;
8 | this.url_domain = true;
9 | this.url_path = false;
10 |
11 | // Settings for the key generation
12 | this.hashAlgorithm = "md4"
13 | this.username = ""
14 | this.modifier = ""
15 | this.passwordLength = 12
16 | this.selectedCharset = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789`~!@#$%^&*()_-+={}|[]\\:\";'<>?,./";
17 | this.passwordPrefix = "";
18 | this.passwordSuffix = "";
19 | this.whereToUseL33t = "off";
20 | this.l33tLevel = 0;
21 | }
22 |
23 | Profile.prototype.getPassword = function(url, masterkey) {
24 | if (this.selectedCharset.length < 2) {
25 | return "Not enough chars!";
26 | }
27 |
28 | // Calls generatepassword() n times in order to support passwords
29 | // of arbitrary length regardless of character set length.
30 | var password = "";
31 | var count = 0;
32 | while (password.length < this.passwordLength) {
33 | // To maintain backwards compatibility with all previous versions of passwordmaker,
34 | // the first call to _generatepassword() must use the plain "key".
35 | // Subsequent calls add a number to the end of the key so each iteration
36 | // doesn't generate the same hash value.
37 | password += (count == 0) ?
38 | this.generateCharacter(this.hashAlgorithm, masterkey,
39 | url + this.username + this.modifier, this.whereToUseL33t, this.l33tLevel,
40 | this.selectedCharset) :
41 | this.generateCharacter(this.hashAlgorithm, masterkey + '\n' + count,
42 | url + this.username + this.modifier, this.whereToUseL33t, this.l33tLevel,
43 | this.selectedCharset);
44 | count++;
45 | }
46 |
47 | if (this.passwordPrefix) {
48 | password = this.passwordPrefix + password;
49 | }
50 | if (this.passwordSuffix) {
51 | password = password.substring(0, this.passwordLength-this.passwordSuffix.length) + this.passwordSuffix;
52 | }
53 |
54 | return password.substring(0, this.passwordLength);
55 | }
56 |
57 | Profile.prototype.generateCharacter = function(hashAlgorithm, key, data, whereToUseL33t, l33tLevel, charset) {
58 | // for non-hmac algorithms, the key is master pw and url concatenated
59 | var usingHMAC = hashAlgorithm.indexOf("hmac") > -1;
60 | if (!usingHMAC) {
61 | key += data;
62 | }
63 |
64 | // apply l33t before the algorithm?
65 | if (whereToUseL33t == "both" || whereToUseL33t == "before-hashing") {
66 | key = PasswordMaker_l33t.convert(l33tLevel, key);
67 | if (usingHMAC) {
68 | data = PasswordMaker_l33t.convert(l33tLevel, data); // new for 0.3; 0.2 didn't apply l33t to _data_ for HMAC algorithms
69 | }
70 | }
71 |
72 | // apply the algorithm
73 | var password = "";
74 | switch(hashAlgorithm) {
75 | case "sha256":
76 | password = PasswordMaker_SHA256.any_sha256(key, charset);
77 | break;
78 | case "hmac-sha256":
79 | password = PasswordMaker_SHA256.any_hmac_sha256(key, data, charset, true);
80 | break;
81 | case "hmac-sha256_fix":
82 | password = PasswordMaker_SHA256.any_hmac_sha256(key, data, charset, false);
83 | break;
84 | case "sha1":
85 | password = PasswordMaker_SHA1.any_sha1(key, charset);
86 | break;
87 | case "hmac-sha1":
88 | password = PasswordMaker_SHA1.any_hmac_sha1(key, data, charset);
89 | break;
90 | case "md4":
91 | password = PasswordMaker_MD4.any_md4(key, charset);
92 | break;
93 | case "hmac-md4":
94 | password = PasswordMaker_MD4.any_hmac_md4(key, data, charset);
95 | break;
96 | case "md5":
97 | password = PasswordMaker_MD5.any_md5(key, charset);
98 | break;
99 | case "md5_v6":
100 | password = PasswordMaker_MD5_V6.hex_md5(key, charset);
101 | break;
102 | case "hmac-md5":
103 | password = PasswordMaker_MD5.any_hmac_md5(key, data, charset);
104 | break;
105 | case "hmac-md5_v6":
106 | password = PasswordMaker_MD5_V6.hex_hmac_md5(key, data, charset);
107 | break;
108 | case "rmd160":
109 | password = PasswordMaker_RIPEMD160.any_rmd160(key, charset);
110 | break;
111 | case "hmac-rmd160":
112 | password = PasswordMaker_RIPEMD160.any_hmac_rmd160(key, data, charset);
113 | break;
114 | }
115 | // apply l33t after the algorithm?
116 | if (whereToUseL33t == "both" || whereToUseL33t == "after-hashing") {
117 | return PasswordMaker_l33t.convert(l33tLevel, password);
118 | }
119 | return password;
120 | }
121 |
122 | // Given a list of domain segments like [www,google,co,uk], return the
123 | // subdomain and domain strings (ie, [www, google.co.uk]).
124 | Profile.prototype.splitSubdomain = function(segments) {
125 | for (var i = 0; i < segments.length; ++i) {
126 | var suffix = segments.slice(i).join('.');
127 | if (suffix in TOPLEVELDOMAINS) {
128 | var pivot = Math.max(0, i-1);
129 | return [segments.slice(0, pivot).join('.'), segments.slice(pivot).join('.')];
130 | }
131 | }
132 | // None of the segments are in our TLD list. Assume the last component is
133 | // the TLD, like ".com". The domain is therefore the last 2 components.
134 | return [segments.slice(0, -2).join('.'), segments.slice(-2).join('.')];
135 | }
136 |
137 |
138 | Profile.prototype.getUrl = function(url) {
139 | if (url == null) {
140 | return "";
141 | }
142 |
143 | //var temp = location.href.match("([^://]*://)([^/]*)(.*)");
144 | temp = url.match("([^://]*://)?([^:/]*)([^#]*)");
145 | if (!temp) {
146 | temp = ['','','','']; // Helps prevent an undefine based error
147 | }
148 | var domainSegments = temp[2].split(".");
149 | while (domainSegments.length < 3) {
150 | domainSegments.unshift(''); // Helps prevent the URL from displaying undefined in the URL to use box
151 | }
152 |
153 | var resultURL = '';
154 | var protocol= this.url_protocol ? temp[1] : ''; // set the protocol or empty string
155 |
156 | var splitSegments = this.splitSubdomain(domainSegments);
157 |
158 | if (this.url_subdomain) {
159 | resultURL += splitSegments[0];
160 | }
161 |
162 | if (this.url_domain) {
163 | if (resultURL != "" && resultURL[resultURL.length-1] != ".") {
164 | resultURL += ".";
165 | }
166 | resultURL += splitSegments[1];
167 | }
168 | resultURL = protocol + resultURL;
169 |
170 | if (this.url_path) {
171 | resultURL += temp[3];
172 | }
173 |
174 | return resultURL;
175 | }
--------------------------------------------------------------------------------
/javascript/passwordmaker/hashutils.js:
--------------------------------------------------------------------------------
1 | /**
2 | PasswordMaker - Creates and manages passwords
3 | Copyright (C) 2005 Eric H. Jung and LeahScape, Inc.
4 | http://passwordmaker.org/
5 | grimholtz@yahoo.com
6 |
7 | This library is free software; you can redistribute it and/or modify it
8 | under the terms of the GNU Lesser General Public License as published by
9 | the Free Software Foundation; either version 2.1 of the License, or (at
10 | your option) any later version.
11 |
12 | This library is distributed in the hope that it will be useful, but WITHOUT
13 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 | FITNESSFOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
15 | for more details.
16 |
17 | You should have received a copy of the GNU Lesser General Public License
18 | along with this library; if not, write to the Free Software Foundation,
19 | Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 | **/
21 |
22 | /*
23 | * Common functions used by md4, md5, ripemd5, sha1, and sha256.
24 | * Version 2.1 Copyright (C) Jerrad Pierce, Paul Johnston 1999 - 2002.
25 | * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
26 | * Distributed under the BSD License
27 | * See http://pajhome.org.uk/crypt/md5 for more info.
28 | *
29 | * Modified by Eric H. Jung (grimholtz@yahoo.com)
30 | */
31 |
32 | if (typeof(PasswordMaker_HashUtils) != "object") {
33 | var PasswordMaker_HashUtils = {
34 |
35 | chrsz : 8, /* bits per input character. 8 - ASCII; 16 - Unicode */
36 |
37 | /*
38 | * Encode a string as utf-8.
39 | * For efficiency, this assumes the input is valid utf-16.
40 | */
41 | str2rstr_utf8 : function(input) {
42 | var output = "";
43 | var i = -1;
44 | var x, y;
45 |
46 | while(++i < input.length)
47 | {
48 | /* Decode utf-16 surrogate pairs */
49 | x = input.charCodeAt(i);
50 | y = i + 1 < input.length ? input.charCodeAt(i + 1) : 0;
51 | if(0xD800 <= x && x <= 0xDBFF && 0xDC00 <= y && y <= 0xDFFF)
52 | {
53 | x = 0x10000 + ((x & 0x03FF) << 10) + (y & 0x03FF);
54 | i++;
55 | }
56 |
57 | /* Encode output as utf-8 */
58 | if(x <= 0x7F)
59 | output += String.fromCharCode(x);
60 | else if(x <= 0x7FF)
61 | output += String.fromCharCode(0xC0 | ((x >>> 6 ) & 0x1F),
62 | 0x80 | ( x & 0x3F));
63 | else if(x <= 0xFFFF)
64 | output += String.fromCharCode(0xE0 | ((x >>> 12) & 0x0F),
65 | 0x80 | ((x >>> 6 ) & 0x3F),
66 | 0x80 | ( x & 0x3F));
67 | else if(x <= 0x1FFFFF)
68 | output += String.fromCharCode(0xF0 | ((x >>> 18) & 0x07),
69 | 0x80 | ((x >>> 12) & 0x3F),
70 | 0x80 | ((x >>> 6 ) & 0x3F),
71 | 0x80 | ( x & 0x3F));
72 | }
73 | return output;
74 | },
75 |
76 | /*
77 | * Convert a raw string to an array of little-endian words
78 | * Characters >255 have their high-byte silently ignored.
79 | */
80 | rstr2binl : function(input) {
81 | var output = Array(input.length >> 2);
82 | for(var i = 0; i < output.length; i++)
83 | output[i] = 0;
84 | for(var i = 0; i < input.length * 8; i += 8)
85 | output[i>>5] |= (input.charCodeAt(i / 8) & 0xFF) << (i%32);
86 | return output;
87 | },
88 |
89 | /*
90 | * Convert an array of little-endian words to a string
91 | */
92 | binl2rstr : function(input) {
93 | var output = "";
94 | for(var i = 0; i < input.length * 32; i += 8)
95 | output += String.fromCharCode((input[i>>5] >>> (i % 32)) & 0xFF);
96 | return output;
97 | },
98 |
99 | /*
100 | * Convert a raw string to an arbitrary string encoding
101 | */
102 | rstr2any : function(input, encoding) {
103 | var divisor = encoding.length;
104 | var remainders = Array();
105 | var i, q, x, quotient;
106 |
107 | /* Convert to an array of 16-bit big-endian values, forming the dividend */
108 | var dividend = Array(input.length / 2);
109 | var inp = new String(input); // EHJ: added
110 | for(i = 0; i < dividend.length; i++) {
111 | dividend[i] = (inp.charCodeAt(i * 2) << 8) | inp.charCodeAt(i * 2 + 1);
112 | }
113 |
114 | /*
115 | * Repeatedly perform a long division. The binary array forms the dividend,
116 | * the length of the encoding is the divisor. Once computed, the quotient
117 | * forms the dividend for the next step. We stop when the dividend is zero.
118 | * All remainders are stored for later use.
119 | */
120 | while(dividend.length > 0) {
121 | quotient = Array();
122 | x = 0;
123 | for(i = 0; i < dividend.length; i++) {
124 | x = (x << 16) + dividend[i];
125 | q = Math.floor(x / divisor);
126 | x -= q * divisor;
127 | if(quotient.length > 0 || q > 0)
128 | quotient[quotient.length] = q;
129 | }
130 | remainders[remainders.length] = x;
131 | dividend = quotient;
132 | }
133 |
134 | /* Convert the remainders to the output string */
135 | var output = "";
136 | for(i = remainders.length - 1; i >= 0; i--)
137 | output += encoding.charAt(remainders[i]);
138 |
139 | return output;
140 | },
141 |
142 | ///===== big endian =====\\\
143 |
144 | /*
145 | * Convert a raw string to an array of big-endian words
146 | * Characters >255 have their high-byte silently ignored.
147 | */
148 | rstr2binb : function(input) {
149 | var output = Array(input.length >> 2);
150 | for(var i = 0; i < output.length; i++)
151 | output[i] = 0;
152 | for(var i = 0; i < input.length * 8; i += 8)
153 | output[i>>5] |= (input.charCodeAt(i / 8) & 0xFF) << (24 - i % 32);
154 | return output;
155 | },
156 |
157 | /*
158 | * Convert an array of big-endian words to a string
159 | */
160 | binb2rstr : function(input) {
161 | var output = "";
162 | for(var i = 0; i < input.length * 32; i += 8)
163 | output += String.fromCharCode((input[i>>5] >>> (24 - i % 32)) & 0xFF);
164 | return output;
165 | },
166 |
167 | /*
168 | * Bitwise rotate a 32-bit number to the left.
169 | */
170 | bit_rol : function(num, cnt) {
171 | return (num << cnt) | (num >>> (32 - cnt));
172 | },
173 |
174 | /*
175 | * Add integers, wrapping at 2^32. This uses 16-bit operations internally
176 | * to work around bugs in some JS interpreters.
177 | */
178 | safe_add : function(x, y) {
179 | var lsw = (x & 0xFFFF) + (y & 0xFFFF);
180 | var msw = (x >> 16) + (y >> 16) + (lsw >> 16);
181 | return (msw << 16) | (lsw & 0xFFFF);
182 | }
183 | }
184 | }
185 |
--------------------------------------------------------------------------------
/javascript/passwordmaker/ripemd160.js:
--------------------------------------------------------------------------------
1 | /*
2 | * A JavaScript implementation of the RIPEMD-160 Algorithm
3 | * Version 2.2-alpha Copyright Jeremy Lin, Paul Johnston 2000 - 2005.
4 | * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
5 | * Distributed under the BSD License
6 | * See http://pajhome.org.uk/crypt/md5 for details.
7 | * Also http://www.esat.kuleuven.ac.be/~cosicart/pdf/AB-9601/
8 | *
9 | * Modified by Eric H. Jung (grimholtz@yahoo.com)
10 | */
11 |
12 | if (typeof(PasswordMaker_RIPEMD160) != "object") {
13 | var PasswordMaker_RIPEMD160 = {
14 |
15 | any_rmd160 : function(s, e){ return PasswordMaker_HashUtils.rstr2any(this.rstr_rmd160(PasswordMaker_HashUtils.str2rstr_utf8(s)), e); },
16 | any_hmac_rmd160 : function(k, d, e){ return PasswordMaker_HashUtils.rstr2any(this.rstr_hmac_rmd160(PasswordMaker_HashUtils.str2rstr_utf8(k), PasswordMaker_HashUtils.str2rstr_utf8(d)), e); },
17 |
18 | /*
19 | * Calculate the rmd160 of a raw string
20 | */
21 | rstr_rmd160 : function(s) {
22 | return PasswordMaker_HashUtils.binl2rstr(this.binl_rmd160(PasswordMaker_HashUtils.rstr2binl(s), s.length * PasswordMaker_HashUtils.chrsz));
23 | },
24 |
25 | /*
26 | * Calculate the HMAC-rmd160 of a key and some data (raw strings)
27 | */
28 | rstr_hmac_rmd160 : function(key, data) {
29 | var bkey = PasswordMaker_HashUtils.rstr2binl(key);
30 | if(bkey.length > 16) bkey = this.binl_rmd160(bkey, key.length * 8);
31 |
32 | var ipad = Array(16), opad = Array(16);
33 | for(var i = 0; i < 16; i++) {
34 | ipad[i] = bkey[i] ^ 0x36363636;
35 | opad[i] = bkey[i] ^ 0x5C5C5C5C;
36 | }
37 |
38 | var hash = this.binl_rmd160(ipad.concat(PasswordMaker_HashUtils.rstr2binl(data)), 512 + data.length * 8);
39 | return PasswordMaker_HashUtils.binl2rstr(this.binl_rmd160(opad.concat(hash), 512 + 160));
40 | },
41 |
42 | /*
43 | * Calculate the RIPE-MD160 of an array of little-endian words, and a bit length.
44 | */
45 | binl_rmd160 : function(x, len) {
46 | /* append padding */
47 | x[len >> 5] |= 0x80 << (len % 32);
48 | x[(((len + 64) >>> 9) << 4) + 14] = len;
49 |
50 | var h0 = 0x67452301;
51 | var h1 = 0xefcdab89;
52 | var h2 = 0x98badcfe;
53 | var h3 = 0x10325476;
54 | var h4 = 0xc3d2e1f0;
55 |
56 | for (var i = 0; i < x.length; i += 16) {
57 | var T;
58 | var A1 = h0, B1 = h1, C1 = h2, D1 = h3, E1 = h4;
59 | var A2 = h0, B2 = h1, C2 = h2, D2 = h3, E2 = h4;
60 | for (var j = 0; j <= 79; ++j) {
61 | T = PasswordMaker_HashUtils.safe_add(A1, this.rmd160_f(j, B1, C1, D1));
62 | T = PasswordMaker_HashUtils.safe_add(T, x[i + this.rmd160_r1[j]]);
63 | T = PasswordMaker_HashUtils.safe_add(T, this.rmd160_K1(j));
64 | T = PasswordMaker_HashUtils.safe_add(PasswordMaker_HashUtils.bit_rol(T, this.rmd160_s1[j]), E1);
65 | A1 = E1; E1 = D1; D1 = PasswordMaker_HashUtils.bit_rol(C1, 10); C1 = B1; B1 = T;
66 | T = PasswordMaker_HashUtils.safe_add(A2, this.rmd160_f(79-j, B2, C2, D2));
67 | T = PasswordMaker_HashUtils.safe_add(T, x[i + this.rmd160_r2[j]]);
68 | T = PasswordMaker_HashUtils.safe_add(T, this.rmd160_K2(j));
69 | T = PasswordMaker_HashUtils.safe_add(PasswordMaker_HashUtils.bit_rol(T, this.rmd160_s2[j]), E2);
70 | A2 = E2; E2 = D2; D2 = PasswordMaker_HashUtils.bit_rol(C2, 10); C2 = B2; B2 = T;
71 | }
72 | T = PasswordMaker_HashUtils.safe_add(h1, PasswordMaker_HashUtils.safe_add(C1, D2));
73 | h1 = PasswordMaker_HashUtils.safe_add(h2, PasswordMaker_HashUtils.safe_add(D1, E2));
74 | h2 = PasswordMaker_HashUtils.safe_add(h3, PasswordMaker_HashUtils.safe_add(E1, A2));
75 | h3 = PasswordMaker_HashUtils.safe_add(h4, PasswordMaker_HashUtils.safe_add(A1, B2));
76 | h4 = PasswordMaker_HashUtils.safe_add(h0, PasswordMaker_HashUtils.safe_add(B1, C2));
77 | h0 = T;
78 | }
79 | return [h0, h1, h2, h3, h4];
80 | },
81 |
82 | /*
83 | * Encode a string as utf-16
84 | */
85 | str2rstr_utf16le : function(input) {
86 | var output = "";
87 | for(var i = 0; i < input.length; i++)
88 | output += String.fromCharCode( input.charCodeAt(i) & 0xFF,
89 | (input.charCodeAt(i) >>> 8) & 0xFF);
90 | return output;
91 | },
92 |
93 | str2rstr_utf16be : function(input) {
94 | var output = "";
95 | for(var i = 0; i < input.length; i++)
96 | output += String.fromCharCode((input.charCodeAt(i) >>> 8) & 0xFF,
97 | input.charCodeAt(i) & 0xFF);
98 | return output;
99 | },
100 |
101 | rmd160_f : function(j, x, y, z) {
102 | return ( 0 <= j && j <= 15) ? (x ^ y ^ z) :
103 | (16 <= j && j <= 31) ? (x & y) | (~x & z) :
104 | (32 <= j && j <= 47) ? (x | ~y) ^ z :
105 | (48 <= j && j <= 63) ? (x & z) | (y & ~z) :
106 | (64 <= j && j <= 79) ? x ^ (y | ~z) :
107 | "rmd160_f: j out of range";
108 | },
109 |
110 | rmd160_K1 : function(j) {
111 | return ( 0 <= j && j <= 15) ? 0x00000000 :
112 | (16 <= j && j <= 31) ? 0x5a827999 :
113 | (32 <= j && j <= 47) ? 0x6ed9eba1 :
114 | (48 <= j && j <= 63) ? 0x8f1bbcdc :
115 | (64 <= j && j <= 79) ? 0xa953fd4e :
116 | "rmd160_K1: j out of range";
117 | },
118 |
119 | rmd160_K2 : function(j) {
120 | return ( 0 <= j && j <= 15) ? 0x50a28be6 :
121 | (16 <= j && j <= 31) ? 0x5c4dd124 :
122 | (32 <= j && j <= 47) ? 0x6d703ef3 :
123 | (48 <= j && j <= 63) ? 0x7a6d76e9 :
124 | (64 <= j && j <= 79) ? 0x00000000 :
125 | "rmd160_K2: j out of range";
126 | },
127 |
128 | rmd160_r1 : [
129 | 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
130 | 7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8,
131 | 3, 10, 14, 4, 9, 15, 8, 1, 2, 7, 0, 6, 13, 11, 5, 12,
132 | 1, 9, 11, 10, 0, 8, 12, 4, 13, 3, 7, 15, 14, 5, 6, 2,
133 | 4, 0, 5, 9, 7, 12, 2, 10, 14, 1, 3, 8, 11, 6, 15, 13
134 | ],
135 |
136 | rmd160_r2 : [
137 | 5, 14, 7, 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3, 12,
138 | 6, 11, 3, 7, 0, 13, 5, 10, 14, 15, 8, 12, 4, 9, 1, 2,
139 | 15, 5, 1, 3, 7, 14, 6, 9, 11, 8, 12, 2, 10, 0, 4, 13,
140 | 8, 6, 4, 1, 3, 11, 15, 0, 5, 12, 2, 13, 9, 7, 10, 14,
141 | 12, 15, 10, 4, 1, 5, 8, 7, 6, 2, 13, 14, 0, 3, 9, 11
142 | ],
143 |
144 | rmd160_s1 : [
145 | 11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8,
146 | 7, 6, 8, 13, 11, 9, 7, 15, 7, 12, 15, 9, 11, 7, 13, 12,
147 | 11, 13, 6, 7, 14, 9, 13, 15, 14, 8, 13, 6, 5, 12, 7, 5,
148 | 11, 12, 14, 15, 14, 15, 9, 8, 9, 14, 5, 6, 8, 6, 5, 12,
149 | 9, 15, 5, 11, 6, 8, 13, 12, 5, 12, 13, 14, 11, 8, 5, 6
150 | ],
151 |
152 | rmd160_s2 : [
153 | 8, 9, 9, 11, 13, 15, 15, 5, 7, 7, 8, 11, 14, 14, 12, 6,
154 | 9, 13, 15, 7, 12, 8, 9, 11, 7, 7, 12, 7, 6, 15, 13, 11,
155 | 9, 7, 15, 11, 8, 6, 6, 14, 12, 13, 5, 14, 13, 13, 7, 5,
156 | 15, 5, 8, 11, 14, 14, 6, 14, 6, 9, 12, 9, 12, 5, 15, 8,
157 | 8, 5, 12, 9, 12, 5, 14, 6, 8, 13, 6, 5, 15, 13, 11, 11
158 | ]
159 | }
160 | }
--------------------------------------------------------------------------------
/javascript/passwordmaker/md5.js:
--------------------------------------------------------------------------------
1 | /*
2 | * A JavaScript implementation of the RSA Data Security, Inc. MD5 Message
3 | * Digest Algorithm, as defined in RFC 1321.
4 | * Version 2.2-alpha Copyright (C) Paul Johnston 1999 - 2005
5 | * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
6 | * Distributed under the BSD License
7 | * See http://pajhome.org.uk/crypt/md5 for more info.
8 | *
9 | * Modified by Eric H. Jung (grimholtz@yahoo.com)
10 | */
11 |
12 | if (typeof(PasswordMaker_MD5) != "object") {
13 | var PasswordMaker_MD5 = {
14 |
15 | any_md5 : function(s, e) { return PasswordMaker_HashUtils.rstr2any(this.rstr_md5(PasswordMaker_HashUtils.str2rstr_utf8(s)), e); },
16 | any_hmac_md5 : function(k, d, e) { return PasswordMaker_HashUtils.rstr2any(this.rstr_hmac_md5(PasswordMaker_HashUtils.str2rstr_utf8(k), PasswordMaker_HashUtils.str2rstr_utf8(d)), e); },
17 |
18 | /*
19 | * Calculate the MD5 of a raw string
20 | */
21 | rstr_md5 : function(s) {
22 | return PasswordMaker_HashUtils.binl2rstr(this.binl_md5(PasswordMaker_HashUtils.rstr2binl(s), s.length * PasswordMaker_HashUtils.chrsz));
23 | },
24 |
25 | /*
26 | * Calculate the MD5 of an array of little-endian words, and a bit length.
27 | */
28 | binl_md5 : function(x, len) {
29 | /* append padding */
30 | x[len >> 5] |= 0x80 << ((len) % 32);
31 | x[(((len + 64) >>> 9) << 4) + 14] = len;
32 |
33 | var a = 1732584193;
34 | var b = -271733879;
35 | var c = -1732584194;
36 | var d = 271733878;
37 |
38 | for(var i = 0; i < x.length; i += 16) {
39 | var olda = a;
40 | var oldb = b;
41 | var oldc = c;
42 | var oldd = d;
43 |
44 | a = this.md5_ff(a, b, c, d, x[i+ 0], 7 , -680876936);
45 | d = this.md5_ff(d, a, b, c, x[i+ 1], 12, -389564586);
46 | c = this.md5_ff(c, d, a, b, x[i+ 2], 17, 606105819);
47 | b = this.md5_ff(b, c, d, a, x[i+ 3], 22, -1044525330);
48 | a = this.md5_ff(a, b, c, d, x[i+ 4], 7 , -176418897);
49 | d = this.md5_ff(d, a, b, c, x[i+ 5], 12, 1200080426);
50 | c = this.md5_ff(c, d, a, b, x[i+ 6], 17, -1473231341);
51 | b = this.md5_ff(b, c, d, a, x[i+ 7], 22, -45705983);
52 | a = this.md5_ff(a, b, c, d, x[i+ 8], 7 , 1770035416);
53 | d = this.md5_ff(d, a, b, c, x[i+ 9], 12, -1958414417);
54 | c = this.md5_ff(c, d, a, b, x[i+10], 17, -42063);
55 | b = this.md5_ff(b, c, d, a, x[i+11], 22, -1990404162);
56 | a = this.md5_ff(a, b, c, d, x[i+12], 7 , 1804603682);
57 | d = this.md5_ff(d, a, b, c, x[i+13], 12, -40341101);
58 | c = this.md5_ff(c, d, a, b, x[i+14], 17, -1502002290);
59 | b = this.md5_ff(b, c, d, a, x[i+15], 22, 1236535329);
60 |
61 | a = this.md5_gg(a, b, c, d, x[i+ 1], 5 , -165796510);
62 | d = this.md5_gg(d, a, b, c, x[i+ 6], 9 , -1069501632);
63 | c = this.md5_gg(c, d, a, b, x[i+11], 14, 643717713);
64 | b = this.md5_gg(b, c, d, a, x[i+ 0], 20, -373897302);
65 | a = this.md5_gg(a, b, c, d, x[i+ 5], 5 , -701558691);
66 | d = this.md5_gg(d, a, b, c, x[i+10], 9 , 38016083);
67 | c = this.md5_gg(c, d, a, b, x[i+15], 14, -660478335);
68 | b = this.md5_gg(b, c, d, a, x[i+ 4], 20, -405537848);
69 | a = this.md5_gg(a, b, c, d, x[i+ 9], 5 , 568446438);
70 | d = this.md5_gg(d, a, b, c, x[i+14], 9 , -1019803690);
71 | c = this.md5_gg(c, d, a, b, x[i+ 3], 14, -187363961);
72 | b = this.md5_gg(b, c, d, a, x[i+ 8], 20, 1163531501);
73 | a = this.md5_gg(a, b, c, d, x[i+13], 5 , -1444681467);
74 | d = this.md5_gg(d, a, b, c, x[i+ 2], 9 , -51403784);
75 | c = this.md5_gg(c, d, a, b, x[i+ 7], 14, 1735328473);
76 | b = this.md5_gg(b, c, d, a, x[i+12], 20, -1926607734);
77 |
78 | a = this.md5_hh(a, b, c, d, x[i+ 5], 4 , -378558);
79 | d = this.md5_hh(d, a, b, c, x[i+ 8], 11, -2022574463);
80 | c = this.md5_hh(c, d, a, b, x[i+11], 16, 1839030562);
81 | b = this.md5_hh(b, c, d, a, x[i+14], 23, -35309556);
82 | a = this.md5_hh(a, b, c, d, x[i+ 1], 4 , -1530992060);
83 | d = this.md5_hh(d, a, b, c, x[i+ 4], 11, 1272893353);
84 | c = this.md5_hh(c, d, a, b, x[i+ 7], 16, -155497632);
85 | b = this.md5_hh(b, c, d, a, x[i+10], 23, -1094730640);
86 | a = this.md5_hh(a, b, c, d, x[i+13], 4 , 681279174);
87 | d = this.md5_hh(d, a, b, c, x[i+ 0], 11, -358537222);
88 | c = this.md5_hh(c, d, a, b, x[i+ 3], 16, -722521979);
89 | b = this.md5_hh(b, c, d, a, x[i+ 6], 23, 76029189);
90 | a = this.md5_hh(a, b, c, d, x[i+ 9], 4 , -640364487);
91 | d = this.md5_hh(d, a, b, c, x[i+12], 11, -421815835);
92 | c = this.md5_hh(c, d, a, b, x[i+15], 16, 530742520);
93 | b = this.md5_hh(b, c, d, a, x[i+ 2], 23, -995338651);
94 |
95 | a = this.md5_ii(a, b, c, d, x[i+ 0], 6 , -198630844);
96 | d = this.md5_ii(d, a, b, c, x[i+ 7], 10, 1126891415);
97 | c = this.md5_ii(c, d, a, b, x[i+14], 15, -1416354905);
98 | b = this.md5_ii(b, c, d, a, x[i+ 5], 21, -57434055);
99 | a = this.md5_ii(a, b, c, d, x[i+12], 6 , 1700485571);
100 | d = this.md5_ii(d, a, b, c, x[i+ 3], 10, -1894986606);
101 | c = this.md5_ii(c, d, a, b, x[i+10], 15, -1051523);
102 | b = this.md5_ii(b, c, d, a, x[i+ 1], 21, -2054922799);
103 | a = this.md5_ii(a, b, c, d, x[i+ 8], 6 , 1873313359);
104 | d = this.md5_ii(d, a, b, c, x[i+15], 10, -30611744);
105 | c = this.md5_ii(c, d, a, b, x[i+ 6], 15, -1560198380);
106 | b = this.md5_ii(b, c, d, a, x[i+13], 21, 1309151649);
107 | a = this.md5_ii(a, b, c, d, x[i+ 4], 6 , -145523070);
108 | d = this.md5_ii(d, a, b, c, x[i+11], 10, -1120210379);
109 | c = this.md5_ii(c, d, a, b, x[i+ 2], 15, 718787259);
110 | b = this.md5_ii(b, c, d, a, x[i+ 9], 21, -343485551);
111 |
112 | a = PasswordMaker_HashUtils.safe_add(a, olda);
113 | b = PasswordMaker_HashUtils.safe_add(b, oldb);
114 | c = PasswordMaker_HashUtils.safe_add(c, oldc);
115 | d = PasswordMaker_HashUtils.safe_add(d, oldd);
116 | }
117 | return Array(a, b, c, d);
118 | },
119 |
120 | /*
121 | * These functions implement the four basic operations the algorithm uses.
122 | */
123 | md5_cmn : function(q, a, b, x, s, t) {
124 | return PasswordMaker_HashUtils.safe_add(PasswordMaker_HashUtils.bit_rol(PasswordMaker_HashUtils.safe_add(PasswordMaker_HashUtils.safe_add(a, q), PasswordMaker_HashUtils.safe_add(x, t)), s),b);
125 | },
126 | md5_ff : function(a, b, c, d, x, s, t) {
127 | return this.md5_cmn((b & c) | ((~b) & d), a, b, x, s, t);
128 | },
129 | md5_gg : function(a, b, c, d, x, s, t) {
130 | return this.md5_cmn((b & d) | (c & (~d)), a, b, x, s, t);
131 | },
132 | md5_hh : function(a, b, c, d, x, s, t) {
133 | return this.md5_cmn(b ^ c ^ d, a, b, x, s, t);
134 | },
135 | md5_ii : function(a, b, c, d, x, s, t) {
136 | return this.md5_cmn(c ^ (b | (~d)), a, b, x, s, t);
137 | },
138 |
139 | /*
140 | * Calculate the HMAC-MD5 of a key and some data (raw strings)
141 | */
142 | rstr_hmac_md5 : function(key, data) {
143 | var bkey = PasswordMaker_HashUtils.rstr2binl(key);
144 | if(bkey.length > 16) bkey = this.binl_md5(bkey, key.length * PasswordMaker_HashUtils.chrsz);
145 |
146 | var ipad = Array(16), opad = Array(16);
147 | for(var i = 0; i < 16; i++) {
148 | ipad[i] = bkey[i] ^ 0x36363636;
149 | opad[i] = bkey[i] ^ 0x5C5C5C5C;
150 | }
151 |
152 | var hash = this.binl_md5(ipad.concat(PasswordMaker_HashUtils.rstr2binl(data)), 512 + data.length * PasswordMaker_HashUtils.chrsz);
153 | return PasswordMaker_HashUtils.binl2rstr(this.binl_md5(opad.concat(hash), 512 + 128));
154 | }
155 | }
156 | }
157 |
158 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | GNU LESSER GENERAL PUBLIC LICENSE
2 | Version 3, 29 June 2007
3 |
4 | Copyright (C) 2007 Free Software Foundation, Inc.
5 | Everyone is permitted to copy and distribute verbatim copies
6 | of this license document, but changing it is not allowed.
7 |
8 |
9 | This version of the GNU Lesser General Public License incorporates
10 | the terms and conditions of version 3 of the GNU General Public
11 | License, supplemented by the additional permissions listed below.
12 |
13 | 0. Additional Definitions.
14 |
15 | As used herein, "this License" refers to version 3 of the GNU Lesser
16 | General Public License, and the "GNU GPL" refers to version 3 of the GNU
17 | General Public License.
18 |
19 | "The Library" refers to a covered work governed by this License,
20 | other than an Application or a Combined Work as defined below.
21 |
22 | An "Application" is any work that makes use of an interface provided
23 | by the Library, but which is not otherwise based on the Library.
24 | Defining a subclass of a class defined by the Library is deemed a mode
25 | of using an interface provided by the Library.
26 |
27 | A "Combined Work" is a work produced by combining or linking an
28 | Application with the Library. The particular version of the Library
29 | with which the Combined Work was made is also called the "Linked
30 | Version".
31 |
32 | The "Minimal Corresponding Source" for a Combined Work means the
33 | Corresponding Source for the Combined Work, excluding any source code
34 | for portions of the Combined Work that, considered in isolation, are
35 | based on the Application, and not on the Linked Version.
36 |
37 | The "Corresponding Application Code" for a Combined Work means the
38 | object code and/or source code for the Application, including any data
39 | and utility programs needed for reproducing the Combined Work from the
40 | Application, but excluding the System Libraries of the Combined Work.
41 |
42 | 1. Exception to Section 3 of the GNU GPL.
43 |
44 | You may convey a covered work under sections 3 and 4 of this License
45 | without being bound by section 3 of the GNU GPL.
46 |
47 | 2. Conveying Modified Versions.
48 |
49 | If you modify a copy of the Library, and, in your modifications, a
50 | facility refers to a function or data to be supplied by an Application
51 | that uses the facility (other than as an argument passed when the
52 | facility is invoked), then you may convey a copy of the modified
53 | version:
54 |
55 | a) under this License, provided that you make a good faith effort to
56 | ensure that, in the event an Application does not supply the
57 | function or data, the facility still operates, and performs
58 | whatever part of its purpose remains meaningful, or
59 |
60 | b) under the GNU GPL, with none of the additional permissions of
61 | this License applicable to that copy.
62 |
63 | 3. Object Code Incorporating Material from Library Header Files.
64 |
65 | The object code form of an Application may incorporate material from
66 | a header file that is part of the Library. You may convey such object
67 | code under terms of your choice, provided that, if the incorporated
68 | material is not limited to numerical parameters, data structure
69 | layouts and accessors, or small macros, inline functions and templates
70 | (ten or fewer lines in length), you do both of the following:
71 |
72 | a) Give prominent notice with each copy of the object code that the
73 | Library is used in it and that the Library and its use are
74 | covered by this License.
75 |
76 | b) Accompany the object code with a copy of the GNU GPL and this license
77 | document.
78 |
79 | 4. Combined Works.
80 |
81 | You may convey a Combined Work under terms of your choice that,
82 | taken together, effectively do not restrict modification of the
83 | portions of the Library contained in the Combined Work and reverse
84 | engineering for debugging such modifications, if you also do each of
85 | the following:
86 |
87 | a) Give prominent notice with each copy of the Combined Work that
88 | the Library is used in it and that the Library and its use are
89 | covered by this License.
90 |
91 | b) Accompany the Combined Work with a copy of the GNU GPL and this license
92 | document.
93 |
94 | c) For a Combined Work that displays copyright notices during
95 | execution, include the copyright notice for the Library among
96 | these notices, as well as a reference directing the user to the
97 | copies of the GNU GPL and this license document.
98 |
99 | d) Do one of the following:
100 |
101 | 0) Convey the Minimal Corresponding Source under the terms of this
102 | License, and the Corresponding Application Code in a form
103 | suitable for, and under terms that permit, the user to
104 | recombine or relink the Application with a modified version of
105 | the Linked Version to produce a modified Combined Work, in the
106 | manner specified by section 6 of the GNU GPL for conveying
107 | Corresponding Source.
108 |
109 | 1) Use a suitable shared library mechanism for linking with the
110 | Library. A suitable mechanism is one that (a) uses at run time
111 | a copy of the Library already present on the user's computer
112 | system, and (b) will operate properly with a modified version
113 | of the Library that is interface-compatible with the Linked
114 | Version.
115 |
116 | e) Provide Installation Information, but only if you would otherwise
117 | be required to provide such information under section 6 of the
118 | GNU GPL, and only to the extent that such information is
119 | necessary to install and execute a modified version of the
120 | Combined Work produced by recombining or relinking the
121 | Application with a modified version of the Linked Version. (If
122 | you use option 4d0, the Installation Information must accompany
123 | the Minimal Corresponding Source and Corresponding Application
124 | Code. If you use option 4d1, you must provide the Installation
125 | Information in the manner specified by section 6 of the GNU GPL
126 | for conveying Corresponding Source.)
127 |
128 | 5. Combined Libraries.
129 |
130 | You may place library facilities that are a work based on the
131 | Library side by side in a single library together with other library
132 | facilities that are not Applications and are not covered by this
133 | License, and convey such a combined library under terms of your
134 | choice, if you do both of the following:
135 |
136 | a) Accompany the combined library with a copy of the same work based
137 | on the Library, uncombined with any other library facilities,
138 | conveyed under the terms of this License.
139 |
140 | b) Give prominent notice with the combined library that part of it
141 | is a work based on the Library, and explaining where to find the
142 | accompanying uncombined form of the same work.
143 |
144 | 6. Revised Versions of the GNU Lesser General Public License.
145 |
146 | The Free Software Foundation may publish revised and/or new versions
147 | of the GNU Lesser General Public License from time to time. Such new
148 | versions will be similar in spirit to the present version, but may
149 | differ in detail to address new problems or concerns.
150 |
151 | Each version is given a distinguishing version number. If the
152 | Library as you received it specifies that a certain numbered version
153 | of the GNU Lesser General Public License "or any later version"
154 | applies to it, you have the option of following the terms and
155 | conditions either of that published version or of any later version
156 | published by the Free Software Foundation. If the Library as you
157 | received it does not specify a version number of the GNU Lesser
158 | General Public License, you may choose any version of the GNU Lesser
159 | General Public License ever published by the Free Software Foundation.
160 |
161 | If the Library as you received it specifies that a proxy can decide
162 | whether future versions of the GNU Lesser General Public License shall
163 | apply, that proxy's public statement of acceptance of any version is
164 | permanent authorization for you to choose that version for the
165 | Library.
166 |
--------------------------------------------------------------------------------
/javascript/options.js:
--------------------------------------------------------------------------------
1 | var currentProfile = null;
2 |
3 | var CHARSET_OPTIONS = [
4 | "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789`~!@#$%^&*()_-+={}|[]\\:\";'<>?,./",
5 | "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",
6 | "0123456789abcdef",
7 | "0123456789",
8 | "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",
9 | "`~!@#$%^&*()_-+={}|[]:\";'<>?,./"
10 | ];
11 |
12 | function editProfile(id) {
13 | p = Settings.getProfile(id);
14 | setCurrentProfile(p);
15 | }
16 |
17 | function updateStyle(element, selected, isSelected) {
18 | if (isSelected) {
19 | element.addClass(selected);
20 | } else {
21 | element.removeClass(selected);
22 | }
23 | }
24 |
25 | function updateExample() {
26 | updateStyle($("#exprotocol"), "selected", $("#protocolCB").is(":checked"));
27 | updateStyle($("#exsubdomain"), "selected", $("#subdomainCB").is(":checked"));
28 | updateStyle($("#exdomain"), "selected", $("#domainCB").is(":checked"));
29 | updateStyle($("#expath"), "selected", $("#pathCB").is(":checked"));
30 | }
31 |
32 | function updateLeet() {
33 | $("#leetLevelLB").attr("disabled", $("#whereLeetLB").val() == "off");
34 | updateStyle($("#leetLevelLabel"), "disabled", $("#whereLeetLB").val() == "off");
35 | }
36 |
37 | function updateRemoveButton() {
38 | if (Settings.getProfiles().length <= 1) {
39 | $("#remove").hide();
40 | } else {
41 | $("#remove").show();
42 | }
43 | }
44 |
45 | function addProfile() {
46 | p = new Profile();
47 | p.title = "No name";
48 | Settings.addProfile(p);
49 | updateProfileList();
50 | setCurrentProfile(p);
51 | updateRemoveButton();
52 | }
53 |
54 | function removeProfile() {
55 | if (confirm("Really delete this profile?")) {
56 | Settings.deleteProfile(currentProfile);
57 | currentProfile = Settings.getProfiles()[0];
58 | updateProfileList();
59 | setCurrentProfile(currentProfile);
60 | updateRemoveButton();
61 | }
62 | }
63 |
64 | function setCurrentProfile(profile) {
65 | currentProfile = profile;
66 | $("#profileNameTB").val(profile.title);
67 | $("#protocolCB").attr('checked', profile.url_protocol);
68 | $("#subdomainCB").attr('checked', profile.url_subdomain);
69 | $("#domainCB").attr('checked', profile.url_domain);
70 | $("#pathCB").attr('checked', profile.url_path);
71 |
72 | $("#whereLeetLB").val(profile.whereToUseL33t);
73 | $("#leetLevelLB").val(profile.l33tLevel);
74 | $("#hashAlgorithmLB").val(profile.hashAlgorithm);
75 | $("#passwdLength").val(profile.passwordLength);
76 | $("#usernameTB").val(profile.username);
77 | $("#modifier").val(profile.modifier);
78 | $("#passwordPrefix").val(profile.passwordPrefix);
79 | $("#passwordSuffix").val(profile.passwordSuffix);
80 |
81 | $("#charset").empty();
82 |
83 | for (var i in CHARSET_OPTIONS) {
84 | $("#charset").append(""+CHARSET_OPTIONS[i]+" ");
85 | }
86 | $("#charset").append("Custom charset ");
87 |
88 | $("#charset").change(function() {
89 | if ($("#charset").val() == "Custom charset"){
90 | $("#customCharset").val(profile.selectedCharset);
91 | $("#customCharset").show();
92 | } else {
93 | $("#customCharset").hide();
94 | }
95 | });
96 |
97 | if ($.inArray(profile.selectedCharset, CHARSET_OPTIONS) != -1) {
98 | $("#charset").val(profile.selectedCharset);
99 | $("#customCharset").hide();
100 | } else {
101 | $("#charset").val("Custom charset");
102 | $("#customCharset").val(profile.selectedCharset);
103 | $("#customCharset").show();
104 | }
105 |
106 | updateExample();
107 | updateLeet();
108 |
109 | highlightProfile();
110 |
111 | showSection('#profile_setting');
112 | }
113 |
114 | function showImport(){
115 | showSection('#import_settings');
116 | }
117 |
118 | function importRdf(){
119 | var txt = $('#importText').val();
120 |
121 | if(!txt.length){
122 | alert("Import text is empty");
123 | return false;
124 | }
125 |
126 | var rdfDoc = RdfImporter.loadDoc(txt);
127 |
128 | var count = RdfImporter.saveProfiles(rdfDoc.profiles);
129 |
130 | if(!count){
131 | alert("Sorry, no profiles found");
132 | return false;
133 | }
134 |
135 | updateProfileList();
136 | updateRemoveButton();
137 | }
138 |
139 | function showOptions() {
140 | showSection('#general_settings');
141 | }
142 |
143 | function showSection(showId) {
144 | if(!$(showId).is(":visible")){
145 | $('#profile_setting:visible,#import_settings:visible,#general_settings:visible')
146 | .fadeOut(300, function(){
147 | $(showId).fadeIn(300);
148 | });
149 | }
150 | }
151 |
152 | function highlightProfile(){
153 | $("#profile_id_" + currentProfile.id).animate({"background-color": "#ffff00"}, 500, 'linear', function() {
154 | $("#profile_id_" + currentProfile.id).animate({"background-color": "#ffffff"}, 500)
155 | });
156 | }
157 |
158 | function saveProfile() {
159 | currentProfile.title = $("#profileNameTB").val();
160 | currentProfile.url_protocol = $("#protocolCB").attr('checked');
161 | currentProfile.url_subdomain = $("#subdomainCB").attr('checked');
162 | currentProfile.url_domain = $("#domainCB").attr('checked');
163 | currentProfile.url_path = $("#pathCB").attr('checked');
164 | currentProfile.whereToUseL33t = $("#whereLeetLB").val();
165 | currentProfile.l33tLevel = $("#leetLevelLB").val();
166 | currentProfile.hashAlgorithm = $("#hashAlgorithmLB").val();
167 | currentProfile.passwordLength = $("#passwdLength").val();
168 | currentProfile.username = $("#usernameTB").val();
169 | currentProfile.modifier = $("#modifier").val();
170 | currentProfile.passwordPrefix = $("#passwordPrefix").val();
171 | currentProfile.passwordSuffix = $("#passwordSuffix").val();
172 |
173 | if ($("#charset").val() == "Custom charset"){
174 | currentProfile.selectedCharset= $("#customCharset").val();
175 | } else {
176 | currentProfile.selectedCharset= $("#charset").val();
177 | }
178 |
179 | Settings.saveProfiles();
180 | updateProfileList();
181 | highlightProfile();
182 | }
183 |
184 | function cloneProfile() {
185 | var p = jQuery.extend({}, currentProfile);
186 | p.title = p.title + " Copy";
187 | Settings.addProfile(p);
188 | updateProfileList();
189 | setCurrentProfile(p);
190 | updateRemoveButton();
191 | }
192 |
193 | function updateProfileList() {
194 | var profiles = Settings.getProfiles();
195 | var list = "";
196 |
197 | for (var i in profiles) {
198 | var profile = profiles[i];
199 | list += ""+profile.title+" ";
200 | }
201 | $("#profile_list").empty().append(list);
202 | }
203 |
204 | function updateMasterHash() {
205 | var should_keep = ($("#keepMasterPasswordHash").attr('checked') == true);
206 | Settings.setKeepMasterPasswordHash(should_keep);
207 | if ( should_keep ) {
208 | var master_pass = $("#masterPassword").val();
209 | var new_hash = ChromePasswordMaker_SecureHash.make_hash(master_pass);
210 | Settings.setMasterPasswordHash(new_hash);
211 | $("#master_password_row").css('visibility', 'visible');
212 | } else {
213 | Settings.setMasterPasswordHash("");
214 | $("#master_password_row").css('visibility', 'hidden');
215 | }
216 | }
217 |
218 | function updateHidePassword() {
219 | Settings.setHidePassword($("#hidePassword").attr('checked') == true);
220 | }
221 |
222 | $(function() {
223 | updateProfileList();
224 | setCurrentProfile(Settings.getProfiles()[0]);
225 | updateRemoveButton();
226 |
227 | $("#hidePassword").attr('checked', Settings.shouldHidePassword());
228 | $("#keepMasterPasswordHash").attr('checked', Settings.keepMasterPasswordHash());
229 | if (Settings.keepMasterPasswordHash())
230 | $("#master_password_row").css('visibility', 'visible');
231 | else
232 | $("#master_password_row").css('visibility', 'hidden');
233 | });
234 |
--------------------------------------------------------------------------------
/javascript/passwordmaker/md5_v6.js:
--------------------------------------------------------------------------------
1 | /*
2 | * A JavaScript implementation of the RSA Data Security, Inc. MD5 Message
3 | * Digest Algorithm, as defined in RFC 1321.
4 | * Version 2.1 Copyright (C) Paul Johnston 1999 - 2002.
5 | * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
6 | * Distributed under the BSD License
7 | * See http://pajhome.org.uk/crypt/md5 for more info.
8 | *
9 | * Modified by Eric H. Jung (grimholtz@yahoo.com)
10 | * Note: Differs from md5.js because it retains leading 0's
11 | * (for version 0.6 compliance)
12 | */
13 |
14 | if (typeof(PasswordMaker_MD5_V6) != "boolean") {
15 | var PasswordMaker_MD5_V6 = true;
16 | var PasswordMaker_MD5_V6 = {
17 |
18 | /*
19 | * Configurable variables. You may need to tweak these to be compatible with
20 | * the server-side, but the defaults work in most cases.
21 | */
22 | hexcase : 0, /* hex output format. 0 - lowercase; 1 - uppercase */
23 | b64pad : "", /* base-64 pad character. "=" for strict RFC compliance */
24 | chrsz : 8, /* bits per input character. 8 - ASCII; 16 - Unicode */
25 |
26 | /*
27 | * These are the functions you'll usually want to call
28 | * They take string arguments and return either hex or base-64 encoded strings
29 | */
30 | hex_md5 : function(key) {
31 | return this.binl2hex(this.core_md5(this.str2binl(key), key.length * this.chrsz));
32 | },
33 | hex_hmac_md5 : function(key, data) {return this.binl2hex(this.core_hmac_md5(key, data)); },
34 |
35 | /*
36 | * Calculate the MD5 of an array of little-endian words, and a bit length
37 | */
38 | core_md5 : function(x, len)
39 | {
40 | /* append padding */
41 | x[len >> 5] |= 0x80 << ((len) % 32);
42 | x[(((len + 64) >>> 9) << 4) + 14] = len;
43 |
44 | var a = 1732584193;
45 | var b = -271733879;
46 | var c = -1732584194;
47 | var d = 271733878;
48 |
49 | for(var i = 0; i < x.length; i += 16)
50 | {
51 | var olda = a;
52 | var oldb = b;
53 | var oldc = c;
54 | var oldd = d;
55 |
56 | a = this.md5_ff(a, b, c, d, x[i+ 0], 7 , -680876936);
57 | d = this.md5_ff(d, a, b, c, x[i+ 1], 12, -389564586);
58 | c = this.md5_ff(c, d, a, b, x[i+ 2], 17, 606105819);
59 | b = this.md5_ff(b, c, d, a, x[i+ 3], 22, -1044525330);
60 | a = this.md5_ff(a, b, c, d, x[i+ 4], 7 , -176418897);
61 | d = this.md5_ff(d, a, b, c, x[i+ 5], 12, 1200080426);
62 | c = this.md5_ff(c, d, a, b, x[i+ 6], 17, -1473231341);
63 | b = this.md5_ff(b, c, d, a, x[i+ 7], 22, -45705983);
64 | a = this.md5_ff(a, b, c, d, x[i+ 8], 7 , 1770035416);
65 | d = this.md5_ff(d, a, b, c, x[i+ 9], 12, -1958414417);
66 | c = this.md5_ff(c, d, a, b, x[i+10], 17, -42063);
67 | b = this.md5_ff(b, c, d, a, x[i+11], 22, -1990404162);
68 | a = this.md5_ff(a, b, c, d, x[i+12], 7 , 1804603682);
69 | d = this.md5_ff(d, a, b, c, x[i+13], 12, -40341101);
70 | c = this.md5_ff(c, d, a, b, x[i+14], 17, -1502002290);
71 | b = this.md5_ff(b, c, d, a, x[i+15], 22, 1236535329);
72 |
73 | a = this.md5_gg(a, b, c, d, x[i+ 1], 5 , -165796510);
74 | d = this.md5_gg(d, a, b, c, x[i+ 6], 9 , -1069501632);
75 | c = this.md5_gg(c, d, a, b, x[i+11], 14, 643717713);
76 | b = this.md5_gg(b, c, d, a, x[i+ 0], 20, -373897302);
77 | a = this.md5_gg(a, b, c, d, x[i+ 5], 5 , -701558691);
78 | d = this.md5_gg(d, a, b, c, x[i+10], 9 , 38016083);
79 | c = this.md5_gg(c, d, a, b, x[i+15], 14, -660478335);
80 | b = this.md5_gg(b, c, d, a, x[i+ 4], 20, -405537848);
81 | a = this.md5_gg(a, b, c, d, x[i+ 9], 5 , 568446438);
82 | d = this.md5_gg(d, a, b, c, x[i+14], 9 , -1019803690);
83 | c = this.md5_gg(c, d, a, b, x[i+ 3], 14, -187363961);
84 | b = this.md5_gg(b, c, d, a, x[i+ 8], 20, 1163531501);
85 | a = this.md5_gg(a, b, c, d, x[i+13], 5 , -1444681467);
86 | d = this.md5_gg(d, a, b, c, x[i+ 2], 9 , -51403784);
87 | c = this.md5_gg(c, d, a, b, x[i+ 7], 14, 1735328473);
88 | b = this.md5_gg(b, c, d, a, x[i+12], 20, -1926607734);
89 |
90 | a = this.md5_hh(a, b, c, d, x[i+ 5], 4 , -378558);
91 | d = this.md5_hh(d, a, b, c, x[i+ 8], 11, -2022574463);
92 | c = this.md5_hh(c, d, a, b, x[i+11], 16, 1839030562);
93 | b = this.md5_hh(b, c, d, a, x[i+14], 23, -35309556);
94 | a = this.md5_hh(a, b, c, d, x[i+ 1], 4 , -1530992060);
95 | d = this.md5_hh(d, a, b, c, x[i+ 4], 11, 1272893353);
96 | c = this.md5_hh(c, d, a, b, x[i+ 7], 16, -155497632);
97 | b = this.md5_hh(b, c, d, a, x[i+10], 23, -1094730640);
98 | a = this.md5_hh(a, b, c, d, x[i+13], 4 , 681279174);
99 | d = this.md5_hh(d, a, b, c, x[i+ 0], 11, -358537222);
100 | c = this.md5_hh(c, d, a, b, x[i+ 3], 16, -722521979);
101 | b = this.md5_hh(b, c, d, a, x[i+ 6], 23, 76029189);
102 | a = this.md5_hh(a, b, c, d, x[i+ 9], 4 , -640364487);
103 | d = this.md5_hh(d, a, b, c, x[i+12], 11, -421815835);
104 | c = this.md5_hh(c, d, a, b, x[i+15], 16, 530742520);
105 | b = this.md5_hh(b, c, d, a, x[i+ 2], 23, -995338651);
106 |
107 | a = this.md5_ii(a, b, c, d, x[i+ 0], 6 , -198630844);
108 | d = this.md5_ii(d, a, b, c, x[i+ 7], 10, 1126891415);
109 | c = this.md5_ii(c, d, a, b, x[i+14], 15, -1416354905);
110 | b = this.md5_ii(b, c, d, a, x[i+ 5], 21, -57434055);
111 | a = this.md5_ii(a, b, c, d, x[i+12], 6 , 1700485571);
112 | d = this.md5_ii(d, a, b, c, x[i+ 3], 10, -1894986606);
113 | c = this.md5_ii(c, d, a, b, x[i+10], 15, -1051523);
114 | b = this.md5_ii(b, c, d, a, x[i+ 1], 21, -2054922799);
115 | a = this.md5_ii(a, b, c, d, x[i+ 8], 6 , 1873313359);
116 | d = this.md5_ii(d, a, b, c, x[i+15], 10, -30611744);
117 | c = this.md5_ii(c, d, a, b, x[i+ 6], 15, -1560198380);
118 | b = this.md5_ii(b, c, d, a, x[i+13], 21, 1309151649);
119 | a = this.md5_ii(a, b, c, d, x[i+ 4], 6 , -145523070);
120 | d = this.md5_ii(d, a, b, c, x[i+11], 10, -1120210379);
121 | c = this.md5_ii(c, d, a, b, x[i+ 2], 15, 718787259);
122 | b = this.md5_ii(b, c, d, a, x[i+ 9], 21, -343485551);
123 |
124 | a = PasswordMaker_HashUtils.safe_add(a, olda);
125 | b = PasswordMaker_HashUtils.safe_add(b, oldb);
126 | c = PasswordMaker_HashUtils.safe_add(c, oldc);
127 | d = PasswordMaker_HashUtils.safe_add(d, oldd);
128 | }
129 | return Array(a, b, c, d);
130 |
131 | },
132 |
133 | /*
134 | * These functions implement the four basic operations the algorithm uses.
135 | */
136 | md5_cmn : function(q, a, b, x, s, t)
137 | {
138 | return PasswordMaker_HashUtils.safe_add(PasswordMaker_HashUtils.bit_rol(PasswordMaker_HashUtils.safe_add(PasswordMaker_HashUtils.safe_add(a, q), PasswordMaker_HashUtils.safe_add(x, t)), s),b);
139 | },
140 | md5_ff : function(a, b, c, d, x, s, t)
141 | {
142 | return this.md5_cmn((b & c) | ((~b) & d), a, b, x, s, t);
143 | },
144 | md5_gg : function(a, b, c, d, x, s, t)
145 | {
146 | return this.md5_cmn((b & d) | (c & (~d)), a, b, x, s, t);
147 | },
148 | md5_hh : function(a, b, c, d, x, s, t)
149 | {
150 | return this.md5_cmn(b ^ c ^ d, a, b, x, s, t);
151 | },
152 | md5_ii : function(a, b, c, d, x, s, t)
153 | {
154 | return this.md5_cmn(c ^ (b | (~d)), a, b, x, s, t);
155 | },
156 |
157 | /*
158 | * Calculate the HMAC-MD5, of a key and some data
159 | */
160 | core_hmac_md5 : function(key, data)
161 | {
162 | var bkey = this.str2binl(key);
163 | if(bkey.length > 16) bkey = this.core_md5(bkey, key.length * this.chrsz);
164 |
165 | var ipad = Array(16), opad = Array(16);
166 | for(var i = 0; i < 16; i++)
167 | {
168 | ipad[i] = bkey[i] ^ 0x36363636;
169 | opad[i] = bkey[i] ^ 0x5C5C5C5C;
170 | }
171 |
172 | var hash = this.core_md5(ipad.concat(this.str2binl(data)), 512 + data.length * this.chrsz);
173 | return this.core_md5(opad.concat(hash), 512 + 128);
174 | },
175 |
176 | /*
177 | * Convert a string to an array of little-endian words
178 | * If chrsz is ASCII, characters >255 have their hi-byte silently ignored.
179 | */
180 | str2binl : function(str)
181 | {
182 | var bin = Array();
183 | var mask = (1 << this.chrsz) - 1;
184 | for(var i = 0; i < str.length * this.chrsz; i += this.chrsz)
185 | bin[i>>5] |= (str.charCodeAt(i / this.chrsz) & mask) << (i%32);
186 | return bin;
187 | },
188 |
189 | /*
190 | * Convert an array of little-endian words to a hex string.
191 | */
192 | binl2hex : function(binarray)
193 | {
194 | var hex_tab = this.hexcase ? "0123456789ABCDEF" : "0123456789abcdef";
195 | var str = "";
196 | for(var i = 0; i < binarray.length * 4; i++)
197 | {
198 | str += hex_tab.charAt((binarray[i>>2] >> ((i%4)*8+4)) & 0xF) +
199 | hex_tab.charAt((binarray[i>>2] >> ((i%4)*8 )) & 0xF);
200 | }
201 | return str;
202 | }
203 | }
204 | }
205 |
--------------------------------------------------------------------------------
/javascript/settings.js:
--------------------------------------------------------------------------------
1 | var Settings = {
2 | activeProfileId : localStorage["profile_id"],
3 | storeLocation: localStorage["store_location"],
4 | password: "",
5 | profiles: null
6 | };
7 |
8 | // List of top-level domains, parsed from domains.rdf from the PasswordMaker
9 | // Firefox version.
10 | var TOPLEVELDOMAINS = {
11 | "aland.fi":1, "wa.edu.au":1, "nsw.edu.au":1, "vic.edu.au":1, "csiro.au":1,
12 | "conf.au":1, "info.au":1, "oz.au":1, "telememo.au":1, "sa.edu.au":1,
13 | "nt.edu.au":1, "tas.edu.au":1, "act.edu.au":1, "wa.gov.au":1, "nsw.gov.au":1,
14 | "vic.gov.au":1, "qld.gov.au":1, "sa.gov.au":1, "tas.gov.au":1, "nt.gov.au":1,
15 | "act.gov.au":1, "archie.au":1, "edu.au":1, "gov.au":1, "id.au":1, "org.au":1,
16 | "asn.au":1, "net.au":1, "com.au":1, "qld.edu.au":1, "com.bb":1, "net.bb":1,
17 | "org.bb":1, "gov.bb":1, "agr.br":1, "am.br":1, "art.br":1, "edu.br":1,
18 | "com.br":1, "coop.br":1, "esp.br":1, "far.br":1, "fm.br":1, "g12.br":1,
19 | "gov.br":1, "imb.br":1, "ind.br":1, "inf.br":1, "mil.br":1, "net.br":1,
20 | "org.br":1, "psi.br":1, "rec.br":1, "srv.br":1, "tmp.br":1, "tur.br":1,
21 | "tv.br":1, "etc.br":1, "adm.br":1, "adv.br":1, "arq.br":1, "ato.br":1,
22 | "bio.br":1, "bmd.br":1, "cim.br":1, "cng.br":1, "cnt.br":1, "ecn.br":1,
23 | "eng.br":1, "eti.br":1, "fnd.br":1, "fot.br":1, "fst.br":1, "ggf.br":1,
24 | "jor.br":1, "lel.br":1, "mat.br":1, "med.br":1, "mus.br":1, "not.br":1,
25 | "ntr.br":1, "odo.br":1, "ppg.br":1, "pro.br":1, "psc.br":1, "qsl.br":1,
26 | "slg.br":1, "trd.br":1, "vet.br":1, "zlg.br":1, "nom.br":1, "ab.ca":1,
27 | "bc.ca":1, "mb.ca":1, "nb.ca":1, "nf.ca":1, "nl.ca":1, "ns.ca":1, "nt.ca":1,
28 | "nu.ca":1, "on.ca":1, "pe.ca":1, "qc.ca":1, "sk.ca":1, "yk.ca":1, "com.cd":1,
29 | "net.cd":1, "org.cd":1, "ac.cn":1, "com.cn":1, "edu.cn":1, "gov.cn":1,
30 | "net.cn":1, "org.cn":1, "ah.cn":1, "bj.cn":1, "cq.cn":1, "fj.cn":1,
31 | "gd.cn":1, "gs.cn":1, "gz.cn":1, "gx.cn":1, "ha.cn":1, "hb.cn":1, "he.cn":1,
32 | "hi.cn":1, "hl.cn":1, "hn.cn":1, "jl.cn":1, "js.cn":1, "jx.cn":1, "ln.cn":1,
33 | "nm.cn":1, "nx.cn":1, "qh.cn":1, "sc.cn":1, "sd.cn":1, "sh.cn":1, "sn.cn":1,
34 | "sx.cn":1, "tj.cn":1, "xj.cn":1, "xz.cn":1, "yn.cn":1, "zj.cn":1, "co.ck":1,
35 | "org.ck":1, "edu.ck":1, "gov.ck":1, "net.ck":1, "ac.cr":1, "co.cr":1,
36 | "ed.cr":1, "fi.cr":1, "go.cr":1, "or.cr":1, "sa.cr":1, "eu.int":1, "ac.in":1,
37 | "co.in":1, "edu.in":1, "firm.in":1, "gen.in":1, "gov.in":1, "ind.in":1,
38 | "mil.in":1, "net.in":1, "org.in":1, "res.in":1, "ac.id":1, "co.id":1,
39 | "or.id":1, "net.id":1, "web.id":1, "sch.id":1, "go.id":1, "mil.id":1,
40 | "war.net.id":1, "ac.nz":1, "co.nz":1, "cri.nz":1, "gen.nz":1, "geek.nz":1,
41 | "govt.nz":1, "iwi.nz":1, "maori.nz":1, "mil.nz":1, "net.nz":1, "org.nz":1,
42 | "school.nz":1, "aid.pl":1, "agro.pl":1, "atm.pl":1, "auto.pl":1, "biz.pl":1,
43 | "com.pl":1, "edu.pl":1, "gmina.pl":1, "gsm.pl":1, "info.pl":1, "mail.pl":1,
44 | "miasta.pl":1, "media.pl":1, "nil.pl":1, "net.pl":1, "nieruchomosci.pl":1,
45 | "nom.pl":1, "pc.pl":1, "powiat.pl":1, "priv.pl":1, "realestate.pl":1,
46 | "rel.pl":1, "sex.pl":1, "shop.pl":1, "sklep.pl":1, "sos.pl":1, "szkola.pl":1,
47 | "targi.pl":1, "tm.pl":1, "tourism.pl":1, "travel.pl":1, "turystyka.pl":1,
48 | "com.pt":1, "edu.pt":1, "gov.pt":1, "int.pt":1, "net.pt":1, "nome.pt":1,
49 | "org.pt":1, "publ.pt":1, "com.tw":1, "club.tw":1, "ebiz.tw":1, "game.tw":1,
50 | "gov.tw":1, "idv.tw":1, "net.tw":1, "org.tw":1, "av.tr":1, "bbs.tr":1,
51 | "bel.tr":1, "biz.tr":1, "com.tr":1, "dr.tr":1, "edu.tr":1, "gen.tr":1,
52 | "gov.tr":1, "info.tr":1, "k12.tr":1, "mil.tr":1, "name.tr":1, "net.tr":1,
53 | "org.tr":1, "pol.tr":1, "tel.tr":1, "web.tr":1, "ac.za":1, "city.za":1,
54 | "co.za":1, "edu.za":1, "gov.za":1, "law.za":1, "mil.za":1, "nom.za":1,
55 | "org.za":1, "school.za":1, "alt.za":1, "net.za":1, "ngo.za":1, "tm.za":1,
56 | "web.za":1, "bourse.za":1, "agric.za":1, "cybernet.za":1, "grondar.za":1,
57 | "iaccess.za":1, "inca.za":1, "nis.za":1, "olivetti.za":1, "pix.za":1,
58 | "db.za":1, "imt.za":1, "landesign.za":1, "co.kr":1, "pe.kr":1, "or.kr":1,
59 | "go.kr":1, "ac.kr":1, "mil.kr":1, "ne.kr":1, "chiyoda.tokyo.jp":1,
60 | "tcvb.or.jp":1, "ac.jp":1, "ad.jp":1, "co.jp":1, "ed.jp":1, "go.jp":1,
61 | "gr.jp":1, "lg.jp":1, "ne.jp":1, "or.jp":1, "com.mx":1, "net.mx":1,
62 | "org.mx":1, "edu.mx":1, "gob.mx":1, "ac.uk":1, "co.uk":1, "gov.uk":1,
63 | "ltd.uk":1, "me.uk":1, "mod.uk":1, "net.uk":1, "nic.uk":1, "nhs.uk":1,
64 | "org.uk":1, "plc.uk":1, "police.uk":1, "sch.uk":1, "ak.us":1, "al.us":1,
65 | "ar.us":1, "az.us":1, "ca.us":1, "co.us":1, "ct.us":1, "dc.us":1, "de.us":1,
66 | "dni.us":1, "fed.us":1, "fl.us":1, "ga.us":1, "hi.us":1, "ia.us":1,
67 | "id.us":1, "il.us":1, "in.us":1, "isa.us":1, "kids.us":1, "ks.us":1,
68 | "ky.us":1, "la.us":1, "ma.us":1, "md.us":1, "me.us":1, "mi.us":1, "mn.us":1,
69 | "mo.us":1, "ms.us":1, "mt.us":1, "nc.us":1, "nd.us":1, "ne.us":1, "nh.us":1,
70 | "nj.us":1, "nm.us":1, "nsn.us":1, "nv.us":1, "ny.us":1, "oh.us":1, "ok.us":1,
71 | "or.us":1, "pa.us":1, "ri.us":1, "sc.us":1, "sd.us":1, "tn.us":1, "tx.us":1,
72 | "ut.us":1, "vt.us":1, "va.us":1, "wa.us":1, "wi.us":1, "wv.us":1, "wy.us":1,
73 | "com.ua":1, "edu.ua":1, "gov.ua":1, "net.ua":1, "org.ua":1, "cherkassy.ua":1,
74 | "chernigov.ua":1, "chernovtsy.ua":1, "ck.ua":1, "cn.ua":1, "crimea.ua":1,
75 | "cv.ua":1, "dn.ua":1, "dnepropetrovsk.ua":1, "donetsk.ua":1, "dp.ua":1,
76 | "if.ua":1, "ivano-frankivsk.ua":1, "kh.ua":1, "kharkov.ua":1, "kherson.ua":1,
77 | "kiev.ua":1, "kirovograd.ua":1, "km.ua":1, "kr.ua":1, "ks.ua":1, "lg.ua":1,
78 | "lugansk.ua":1, "lutsk.ua":1, "lviv.ua":1, "mk.ua":1, "nikolaev.ua":1,
79 | "od.ua":1, "odessa.ua":1, "pl.ua":1, "poltava.ua":1, "rovno.ua":1, "rv.ua":1,
80 | "sebastopol.ua":1, "sumy.ua":1, "te.ua":1, "ternopil.ua":1, "vinnica.ua":1,
81 | "vn.ua":1, "zaporizhzhe.ua":1, "zp.ua":1, "uz.ua":1, "uzhgorod.ua":1,
82 | "zhitomir.ua":1, "zt.ua":1, "ac.il":1, "co.il":1, "org.il":1, "net.il":1,
83 | "k12.il":1, "gov.il":1, "muni.il":1, "idf.il":1, "co.im":1, "org.im":1
84 | }
85 |
86 |
87 | Settings.getProfiles = function() {
88 | if (Settings.profiles == null) {
89 | Settings.loadProfiles();
90 | }
91 |
92 | return Settings.profiles;
93 | }
94 |
95 | Settings.getProfile = function(id) {
96 | var profiles = Settings.getProfiles();
97 | for (var i in profiles) {
98 | if (profiles[i].id == id) {
99 | return profiles[i];
100 | }
101 | }
102 | return null;
103 | }
104 |
105 | Settings.getMaxId = function() {
106 | var maxId = 0;
107 | var profiles = Settings.getProfiles();
108 | for (var i in profiles) {
109 | if (profiles[i].id > maxId) {
110 | maxId = profiles[i].id;
111 | }
112 | }
113 | return maxId;
114 | }
115 |
116 | Settings.addProfile = function(profile) {
117 | if (Settings.profiles == null) {
118 | Settings.getProfiles();
119 | }
120 |
121 | profile.id = Settings.getMaxId() + 1;
122 |
123 | Settings.profiles.push(profile);
124 | }
125 |
126 | Settings.deleteProfile = function(profile) {
127 | var profiles = Settings.getProfiles();
128 | for (var i in profiles) {
129 | if (profiles[i].id == profile.id) {
130 | profiles.splice(i, 1);
131 | Settings.saveProfiles();
132 | }
133 | }
134 | }
135 |
136 | Settings.loadProfiles = function() {
137 | if (localStorage["profiles"] == null || localStorage["profiles"] == "") {
138 | Settings.profiles = [new Profile()];
139 | } else {
140 | try {
141 | json = JSON.parse(localStorage["profiles"]);
142 |
143 | Settings.profiles = [];
144 | $.each(json, function(i) {
145 | p = new Profile();
146 | $.each(json[i], function(key, value) {
147 | p[key] = value;
148 | });
149 | Settings.profiles.push(p);
150 | });
151 | } catch(e) {
152 | Settings.profiles = [new Profile()];
153 | }
154 | }
155 | }
156 |
157 | Settings.saveProfiles = function() {
158 | localStorage["profiles"] = JSON.stringify(Settings.profiles);
159 | }
160 |
161 | Settings.getActiveProfileId = function() {
162 | return Settings.activeProfileId;
163 | }
164 |
165 | Settings.setActiveProfileId = function(id) {
166 | localStorage["profile_id"] = id;
167 | Settings.activeProfileId = id;
168 | }
169 |
170 | Settings.setStoreLocation = function(store) {
171 | if (Settings.storeLocation != store) {
172 | Settings.storeLocation = store;
173 | localStorage["store_location"] = store;
174 | if (Settings.storeLocation != "disk") {
175 | localStorage["password"] = "";
176 | }
177 | if (Settings.storeLocation != "memory") {
178 | Settings.password = "";
179 | }
180 | }
181 | }
182 |
183 | // Make a pseudo-random encryption key... emphasis on *pseudo*
184 | Settings.makeKey = function() {
185 | var hex = ['0','1','2','3','4','5','6','7','8','9','0','a','b','c','d','e','f'];
186 | var keySz = keySizeInBits/4; //keySizeInBits defined in aes.js
187 | var ret = "";
188 | while (ret.length < keySz)
189 | ret += hex[Math.floor(Math.random()*15)];
190 | return ret;
191 | }
192 |
193 | Settings.setPassword = function(password) {
194 | // ToDo: CRYPT THIS!!
195 | if (Settings.storeLocation == "memory") {
196 | Settings.password = password;
197 | localStorage["password"] = "";
198 | chrome.extension.sendRequest({setPassword: true, password: password});
199 | } else if (Settings.storeLocation == "disk") {
200 | Settings.password = password;
201 | key = Settings.makeKey();
202 | localStorage["password_key"] = key;
203 | localStorage["password_crypt"] = byteArrayToHex(rijndaelEncrypt(password, hexToByteArray(key), "CBC"));
204 | chrome.extension.sendRequest({setPassword: true, password: password});
205 | } else {
206 | Settings.password = null;
207 | localStorage["password"] = "";
208 | chrome.extension.sendRequest({setPassword: true, password: null});
209 | }
210 | }
211 |
212 | Settings.getPassword = function(callback) {
213 | if (Settings.password != null && Settings.password.length > 0) {
214 | callback(Settings.password);
215 | } else {
216 | chrome.extension.sendRequest({getPassword: true}, function(response) {
217 | if (response.password != null && response.password.length > 0) {
218 | callback(response.password);
219 | } else if (localStorage["password_crypt"]) {
220 | Settings.password = byteArrayToString(rijndaelDecrypt(hexToByteArray(localStorage["password_crypt"]), hexToByteArray(localStorage["password_key"]), "CBC"));
221 | callback(Settings.password)
222 | } else if (localStorage["password"]) {
223 | Settings.password = localStorage["password"];
224 | Settings.setPassword(Settings.password);
225 | localStorage["password"] = null;
226 | callback(Settings.password);
227 | } else {
228 | callback(null);
229 | }
230 |
231 | });
232 | }
233 | }
234 |
235 | Settings.setHidePassword = function(bool) {
236 | localStorage["show_generated_password"] = bool;
237 | }
238 |
239 | Settings.shouldHidePassword = function() {
240 | bool = localStorage["show_generated_password"];
241 | return bool == "true";
242 | }
243 |
244 | Settings.setKeepMasterPasswordHash = function(bool) {
245 | localStorage["keep_master_password_hash"] = bool;
246 | }
247 |
248 | Settings.keepMasterPasswordHash = function() {
249 | bool = localStorage["keep_master_password_hash"];
250 | return bool == "true";
251 | }
252 |
253 | Settings.masterPasswordCharSet = "0123456789abcdef";
254 |
255 | Settings.setMasterPasswordHash = function(theHash) {
256 | localStorage["master_password_hash"] = theHash;
257 | }
258 |
259 | Settings.masterPasswordHash = function() {
260 | return localStorage["master_password_hash"];
261 | }
262 |
--------------------------------------------------------------------------------
/html/options.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | PasswordMaker Pro
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
26 |
27 |
28 |
29 |
Profiles
30 |
31 |
32 |
35 |
38 |
39 |
40 |
41 |
42 |
43 |
168 |
169 |
189 |
190 |
213 |
214 |
215 |
216 |
219 |
220 |
221 |
222 |
223 |
--------------------------------------------------------------------------------
/javascript/jquery-ui.min.js:
--------------------------------------------------------------------------------
1 | /*!
2 | * jQuery UI 1.8
3 | *
4 | * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)
5 | * Dual licensed under the MIT (MIT-LICENSE.txt)
6 | * and GPL (GPL-LICENSE.txt) licenses.
7 | *
8 | * http://docs.jquery.com/UI
9 | */
/*
10 | * jQuery UI 1.8
11 | *
12 | * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)
13 | * Dual licensed under the MIT (MIT-LICENSE.txt)
14 | * and GPL (GPL-LICENSE.txt) licenses.
15 | *
16 | * http://docs.jquery.com/UI
17 | */
18 | jQuery.ui||(function(a){a.ui={version:"1.8",plugin:{add:function(c,d,f){var e=a.ui[c].prototype;for(var b in f){e.plugins[b]=e.plugins[b]||[];e.plugins[b].push([d,f[b]])}},call:function(b,d,c){var f=b.plugins[d];if(!f||!b.element[0].parentNode){return}for(var e=0;e0){return true}e[b]=1;d=(e[b]>0);e[b]=0;return d},isOverAxis:function(c,b,d){return(c>b)&&(c<(b+d))},isOver:function(g,c,f,e,b,d){return a.ui.isOverAxis(g,f,b)&&a.ui.isOverAxis(c,e,d)},keyCode:{BACKSPACE:8,CAPS_LOCK:20,COMMA:188,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38}};a.fn.extend({_focus:a.fn.focus,focus:function(b,c){return typeof b==="number"?this.each(function(){var d=this;setTimeout(function(){a(d).focus();(c&&c.call(d))},b)}):this._focus.apply(this,arguments)},enableSelection:function(){return this.attr("unselectable","off").css("MozUserSelect","").unbind("selectstart.ui")},disableSelection:function(){return this.attr("unselectable","on").css("MozUserSelect","none").bind("selectstart.ui",function(){return false})},scrollParent:function(){var b;if((a.browser.msie&&(/(static|relative)/).test(this.css("position")))||(/absolute/).test(this.css("position"))){b=this.parents().filter(function(){return(/(relative|absolute|fixed)/).test(a.curCSS(this,"position",1))&&(/(auto|scroll)/).test(a.curCSS(this,"overflow",1)+a.curCSS(this,"overflow-y",1)+a.curCSS(this,"overflow-x",1))}).eq(0)}else{b=this.parents().filter(function(){return(/(auto|scroll)/).test(a.curCSS(this,"overflow",1)+a.curCSS(this,"overflow-y",1)+a.curCSS(this,"overflow-x",1))}).eq(0)}return(/fixed/).test(this.css("position"))||!b.length?a(document):b},zIndex:function(e){if(e!==undefined){return this.css("zIndex",e)}if(this.length){var c=a(this[0]),b,d;while(c.length&&c[0]!==document){b=c.css("position");if(b=="absolute"||b=="relative"||b=="fixed"){d=parseInt(c.css("zIndex"));if(!isNaN(d)&&d!=0){return d}}c=c.parent()}}return 0}});a.extend(a.expr[":"],{data:function(d,c,b){return !!a.data(d,b[3])},focusable:function(c){var d=c.nodeName.toLowerCase(),b=a.attr(c,"tabindex");return(/input|select|textarea|button|object/.test(d)?!c.disabled:"a"==d||"area"==d?c.href||!isNaN(b):!isNaN(b))&&!a(c)["area"==d?"parents":"closest"](":hidden").length},tabbable:function(c){var b=a.attr(c,"tabindex");return(isNaN(b)||b>=0)&&a(c).is(":focusable")}})})(jQuery);;/*
19 | * jQuery UI Effects 1.8
20 | *
21 | * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)
22 | * Dual licensed under the MIT (MIT-LICENSE.txt)
23 | * and GPL (GPL-LICENSE.txt) licenses.
24 | *
25 | * http://docs.jquery.com/UI/Effects/
26 | */
jQuery.effects||(function(g){g.effects={};g.each(["backgroundColor","borderBottomColor","borderLeftColor","borderRightColor","borderTopColor","color","outlineColor"],function(l,k){g.fx.step[k]=function(m){if(!m.colorInit){m.start=j(m.elem,k);m.end=i(m.end);m.colorInit=true}m.elem.style[k]="rgb("+Math.max(Math.min(parseInt((m.pos*(m.end[0]-m.start[0]))+m.start[0],10),255),0)+","+Math.max(Math.min(parseInt((m.pos*(m.end[1]-m.start[1]))+m.start[1],10),255),0)+","+Math.max(Math.min(parseInt((m.pos*(m.end[2]-m.start[2]))+m.start[2],10),255),0)+")"}});function i(l){var k;if(l&&l.constructor==Array&&l.length==3){return l}if(k=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(l)){return[parseInt(k[1],10),parseInt(k[2],10),parseInt(k[3],10)]}if(k=/rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(l)){return[parseFloat(k[1])*2.55,parseFloat(k[2])*2.55,parseFloat(k[3])*2.55]}if(k=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(l)){return[parseInt(k[1],16),parseInt(k[2],16),parseInt(k[3],16)]}if(k=/#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(l)){return[parseInt(k[1]+k[1],16),parseInt(k[2]+k[2],16),parseInt(k[3]+k[3],16)]}if(k=/rgba\(0, 0, 0, 0\)/.exec(l)){return a.transparent}return a[g.trim(l).toLowerCase()]}function j(m,k){var l;do{l=g.curCSS(m,k);if(l!=""&&l!="transparent"||g.nodeName(m,"body")){break}k="backgroundColor"}while(m=m.parentNode);return i(l)}var a={aqua:[0,255,255],azure:[240,255,255],beige:[245,245,220],black:[0,0,0],blue:[0,0,255],brown:[165,42,42],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgrey:[169,169,169],darkgreen:[0,100,0],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkviolet:[148,0,211],fuchsia:[255,0,255],gold:[255,215,0],green:[0,128,0],indigo:[75,0,130],khaki:[240,230,140],lightblue:[173,216,230],lightcyan:[224,255,255],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightyellow:[255,255,224],lime:[0,255,0],magenta:[255,0,255],maroon:[128,0,0],navy:[0,0,128],olive:[128,128,0],orange:[255,165,0],pink:[255,192,203],purple:[128,0,128],violet:[128,0,128],red:[255,0,0],silver:[192,192,192],white:[255,255,255],yellow:[255,255,0],transparent:[255,255,255]};var e=["add","remove","toggle"],c={border:1,borderBottom:1,borderColor:1,borderLeft:1,borderRight:1,borderTop:1,borderWidth:1,margin:1,padding:1};function f(){var n=document.defaultView?document.defaultView.getComputedStyle(this,null):this.currentStyle,o={},l,m;if(n&&n.length&&n[0]&&n[n[0]]){var k=n.length;while(k--){l=n[k];if(typeof n[l]=="string"){m=l.replace(/\-(\w)/g,function(p,q){return q.toUpperCase()});o[m]=n[l]}}}else{for(l in n){if(typeof n[l]==="string"){o[l]=n[l]}}}return o}function b(l){var k,m;for(k in l){m=l[k];if(m==null||g.isFunction(m)||k in c||(/scrollbar/).test(k)||(!(/color/i).test(k)&&isNaN(parseFloat(m)))){delete l[k]}}return l}function h(k,m){var n={_:0},l;for(l in m){if(k[l]!=m[l]){n[l]=m[l]}}return n}g.effects.animateClass=function(k,l,n,m){if(g.isFunction(n)){m=n;n=null}return this.each(function(){var r=g(this),o=r.attr("style")||" ",s=b(f.call(this)),q,p=r.attr("className");g.each(e,function(t,u){if(k[u]){r[u+"Class"](k[u])}});q=b(f.call(this));r.attr("className",p);r.animate(h(s,q),l,n,function(){g.each(e,function(t,u){if(k[u]){r[u+"Class"](k[u])}});if(typeof r.attr("style")=="object"){r.attr("style").cssText="";r.attr("style").cssText=o}else{r.attr("style",o)}if(m){m.apply(this,arguments)}})})};g.fn.extend({_addClass:g.fn.addClass,addClass:function(l,k,n,m){return k?g.effects.animateClass.apply(this,[{add:l},k,n,m]):this._addClass(l)},_removeClass:g.fn.removeClass,removeClass:function(l,k,n,m){return k?g.effects.animateClass.apply(this,[{remove:l},k,n,m]):this._removeClass(l)},_toggleClass:g.fn.toggleClass,toggleClass:function(m,l,k,o,n){if(typeof l=="boolean"||l===undefined){if(!k){return this._toggleClass(m,l)}else{return g.effects.animateClass.apply(this,[(l?{add:m}:{remove:m}),k,o,n])}}else{return g.effects.animateClass.apply(this,[{toggle:m},l,k,o])}},switchClass:function(k,m,l,o,n){return g.effects.animateClass.apply(this,[{add:m,remove:k},l,o,n])}});g.extend(g.effects,{version:"1.8",save:function(l,m){for(var k=0;k").addClass("ui-effects-wrapper").css({fontSize:"100%",background:"transparent",border:"none",margin:0,padding:0});k.wrap(m);m=k.parent();if(k.css("position")=="static"){m.css({position:"relative"});k.css({position:"relative"})}else{g.extend(l,{position:k.css("position"),zIndex:k.css("z-index")});g.each(["top","left","bottom","right"],function(n,o){l[o]=k.css(o);if(isNaN(parseInt(l[o],10))){l[o]="auto"}});k.css({position:"relative",top:0,left:0})}return m.css(l).show()},removeWrapper:function(k){if(k.parent().is(".ui-effects-wrapper")){return k.parent().replaceWith(k)}return k},setTransition:function(l,n,k,m){m=m||{};g.each(n,function(p,o){unit=l.cssUnit(o);if(unit[0]>0){m[o]=unit[0]*k+unit[1]}});return m}});function d(l,k,m,n){if(typeof l=="object"){n=k;m=null;k=l;l=k.effect}if(g.isFunction(k)){n=k;m=null;k={}}if(g.isFunction(m)){n=m;m=null}if(typeof k=="number"||g.fx.speeds[k]){n=m;m=k;k={}}k=k||{};m=m||k.duration;m=g.fx.off?0:typeof m=="number"?m:g.fx.speeds[m]||g.fx.speeds._default;n=n||k.complete;return[l,k,m,n]}g.fn.extend({effect:function(n,m,p,q){var l=d.apply(this,arguments),o={options:l[1],duration:l[2],callback:l[3]},k=g.effects[n];return k&&!g.fx.off?k.call(this,o):this},_show:g.fn.show,show:function(l){if(!l||typeof l=="number"||g.fx.speeds[l]){return this._show.apply(this,arguments)}else{var k=d.apply(this,arguments);k[1].mode="show";return this.effect.apply(this,k)}},_hide:g.fn.hide,hide:function(l){if(!l||typeof l=="number"||g.fx.speeds[l]){return this._hide.apply(this,arguments)}else{var k=d.apply(this,arguments);k[1].mode="hide";return this.effect.apply(this,k)}},__toggle:g.fn.toggle,toggle:function(l){if(!l||typeof l=="number"||g.fx.speeds[l]||typeof l=="boolean"||g.isFunction(l)){return this.__toggle.apply(this,arguments)}else{var k=d.apply(this,arguments);k[1].mode="toggle";return this.effect.apply(this,k)}},cssUnit:function(k){var l=this.css(k),m=[];g.each(["em","px","%","pt"],function(n,o){if(l.indexOf(o)>0){m=[parseFloat(l),o]}});return m}});g.easing.jswing=g.easing.swing;g.extend(g.easing,{def:"easeOutQuad",swing:function(l,m,k,o,n){return g.easing[g.easing.def](l,m,k,o,n)},easeInQuad:function(l,m,k,o,n){return o*(m/=n)*m+k},easeOutQuad:function(l,m,k,o,n){return -o*(m/=n)*(m-2)+k},easeInOutQuad:function(l,m,k,o,n){if((m/=n/2)<1){return o/2*m*m+k}return -o/2*((--m)*(m-2)-1)+k},easeInCubic:function(l,m,k,o,n){return o*(m/=n)*m*m+k},easeOutCubic:function(l,m,k,o,n){return o*((m=m/n-1)*m*m+1)+k},easeInOutCubic:function(l,m,k,o,n){if((m/=n/2)<1){return o/2*m*m*m+k}return o/2*((m-=2)*m*m+2)+k},easeInQuart:function(l,m,k,o,n){return o*(m/=n)*m*m*m+k},easeOutQuart:function(l,m,k,o,n){return -o*((m=m/n-1)*m*m*m-1)+k},easeInOutQuart:function(l,m,k,o,n){if((m/=n/2)<1){return o/2*m*m*m*m+k}return -o/2*((m-=2)*m*m*m-2)+k},easeInQuint:function(l,m,k,o,n){return o*(m/=n)*m*m*m*m+k},easeOutQuint:function(l,m,k,o,n){return o*((m=m/n-1)*m*m*m*m+1)+k},easeInOutQuint:function(l,m,k,o,n){if((m/=n/2)<1){return o/2*m*m*m*m*m+k}return o/2*((m-=2)*m*m*m*m+2)+k},easeInSine:function(l,m,k,o,n){return -o*Math.cos(m/n*(Math.PI/2))+o+k},easeOutSine:function(l,m,k,o,n){return o*Math.sin(m/n*(Math.PI/2))+k},easeInOutSine:function(l,m,k,o,n){return -o/2*(Math.cos(Math.PI*m/n)-1)+k},easeInExpo:function(l,m,k,o,n){return(m==0)?k:o*Math.pow(2,10*(m/n-1))+k},easeOutExpo:function(l,m,k,o,n){return(m==n)?k+o:o*(-Math.pow(2,-10*m/n)+1)+k},easeInOutExpo:function(l,m,k,o,n){if(m==0){return k}if(m==n){return k+o}if((m/=n/2)<1){return o/2*Math.pow(2,10*(m-1))+k}return o/2*(-Math.pow(2,-10*--m)+2)+k},easeInCirc:function(l,m,k,o,n){return -o*(Math.sqrt(1-(m/=n)*m)-1)+k},easeOutCirc:function(l,m,k,o,n){return o*Math.sqrt(1-(m=m/n-1)*m)+k},easeInOutCirc:function(l,m,k,o,n){if((m/=n/2)<1){return -o/2*(Math.sqrt(1-m*m)-1)+k}return o/2*(Math.sqrt(1-(m-=2)*m)+1)+k},easeInElastic:function(l,n,k,u,r){var o=1.70158;var q=0;var m=u;if(n==0){return k}if((n/=r)==1){return k+u}if(!q){q=r*0.3}if(m>8) & 0xFF);
172 | state[2][j] ^= ((roundKey[j]>>16) & 0xFF);
173 | state[3][j] ^= ((roundKey[j]>>24) & 0xFF);
174 | }
175 | }
176 |
177 | // This function creates the expanded key from the input (128/192/256-bit)
178 | // key. The parameter key is an array of bytes holding the value of the key.
179 | // The returned value is an array whose elements are the 32-bit words that
180 | // make up the expanded key.
181 |
182 | function keyExpansion(key) {
183 | var expandedKey = new Array();
184 | var temp;
185 |
186 | // in case the key size or parameters were changed...
187 | Nk = keySizeInBits / 32;
188 | Nb = blockSizeInBits / 32;
189 | Nr = roundsArray[Nk][Nb];
190 |
191 | for (var j=0; j < Nk; j++) // Fill in input key first
192 | expandedKey[j] =
193 | (key[4*j]) | (key[4*j+1]<<8) | (key[4*j+2]<<16) | (key[4*j+3]<<24);
194 |
195 | // Now walk down the rest of the array filling in expanded key bytes as
196 | // per Rijndael's spec
197 | for (j = Nk; j < Nb * (Nr + 1); j++) { // For each word of expanded key
198 | temp = expandedKey[j - 1];
199 | if (j % Nk == 0)
200 | temp = ( (SBox[(temp>>8) & 0xFF]) |
201 | (SBox[(temp>>16) & 0xFF]<<8) |
202 | (SBox[(temp>>24) & 0xFF]<<16) |
203 | (SBox[temp & 0xFF]<<24) ) ^ Rcon[Math.floor(j / Nk) - 1];
204 | else if (Nk > 6 && j % Nk == 4)
205 | temp = (SBox[(temp>>24) & 0xFF]<<24) |
206 | (SBox[(temp>>16) & 0xFF]<<16) |
207 | (SBox[(temp>>8) & 0xFF]<<8) |
208 | (SBox[temp & 0xFF]);
209 | expandedKey[j] = expandedKey[j-Nk] ^ temp;
210 | }
211 | return expandedKey;
212 | }
213 |
214 | // Rijndael's round functions...
215 |
216 | function Round(state, roundKey) {
217 | byteSub(state, "encrypt");
218 | shiftRow(state, "encrypt");
219 | mixColumn(state, "encrypt");
220 | addRoundKey(state, roundKey);
221 | }
222 |
223 | function InverseRound(state, roundKey) {
224 | addRoundKey(state, roundKey);
225 | mixColumn(state, "decrypt");
226 | shiftRow(state, "decrypt");
227 | byteSub(state, "decrypt");
228 | }
229 |
230 | function FinalRound(state, roundKey) {
231 | byteSub(state, "encrypt");
232 | shiftRow(state, "encrypt");
233 | addRoundKey(state, roundKey);
234 | }
235 |
236 | function InverseFinalRound(state, roundKey){
237 | addRoundKey(state, roundKey);
238 | shiftRow(state, "decrypt");
239 | byteSub(state, "decrypt");
240 | }
241 |
242 | // encrypt is the basic encryption function. It takes parameters
243 | // block, an array of bytes representing a plaintext block, and expandedKey,
244 | // an array of words representing the expanded key previously returned by
245 | // keyExpansion(). The ciphertext block is returned as an array of bytes.
246 |
247 | function encrypt(block, expandedKey) {
248 | var i;
249 | if (!block || block.length*8 != blockSizeInBits)
250 | return;
251 | if (!expandedKey)
252 | return;
253 |
254 | block = packBytes(block);
255 | addRoundKey(block, expandedKey);
256 | for (i=1; i0; i--)
277 | InverseRound(block, expandedKey.slice(Nb*i, Nb*(i+1)));
278 | addRoundKey(block, expandedKey);
279 | return unpackBytes(block);
280 | }
281 |
282 | // This method takes a byte array (byteArray) and converts it to a string by
283 | // applying String.fromCharCode() to each value and concatenating the result.
284 | // The resulting string is returned. Note that this function SKIPS zero bytes
285 | // under the assumption that they are padding added in formatPlaintext().
286 | // Obviously, do not invoke this method on raw data that can contain zero
287 | // bytes. It is really only appropriate for printable ASCII/Latin-1
288 | // values. Roll your own function for more robust functionality :)
289 |
290 | function byteArrayToString(byteArray) {
291 | var result = "";
292 | for(var i=0; i "10ff". The function returns a
302 | // string.
303 |
304 | function byteArrayToHex(byteArray) {
305 | var result = "";
306 | if (!byteArray)
307 | return;
308 | for (var i=0; i [16, 255]. This
317 | // function returns an array.
318 |
319 | function hexToByteArray(hexString) {
320 | var byteArray = [];
321 | if (hexString.length % 2) // must have even length
322 | return;
323 | if (hexString.indexOf("0x") == 0 || hexString.indexOf("0X") == 0)
324 | hexString = hexString.substring(2);
325 | for (var i = 0; i 0 && i < bpb; i--)
387 | plaintext[plaintext.length] = 0;
388 |
389 | return plaintext;
390 | }
391 |
392 | // Returns an array containing "howMany" random bytes. YOU SHOULD CHANGE THIS
393 | // TO RETURN HIGHER QUALITY RANDOM BYTES IF YOU ARE USING THIS FOR A "REAL"
394 | // APPLICATION.
395 |
396 | function getRandomBytes(howMany) {
397 | var i;
398 | var bytes = new Array();
399 | for (i=0; i0; block--) {
480 | aBlock =
481 | decrypt(ciphertext.slice(block*bpb,(block+1)*bpb), expandedKey);
482 | if (mode == "CBC")
483 | for (var i=0; i