';
// *** RETURN
return this_html;
} // end Fx
/*____________________________________________________________________________*/
// mushpup_get_hash()
/*____________________________________________________________________________*/
function mushpup_get_hash()
{
// *** DATA
// Debug
var _debug = 0;
// Document Objects
var dom_key = document.getElementsByName("mushpup_passkey")[0];
var dom_check_key = document.getElementsByName("passkey_confirm_input")[0];
var dom_context = document.getElementsByName("site")[0];
var dom_password = document.getElementsByName("password_hash")[0];
// Internal
var input_key = '';
var input_context = '';
var trim_key = '';
var trim_context = '';
var salt = '';
var raw_hash = '';
var the_hash = '';
var _hash_html = '';
// Return
// void
// *** MANIPULATE
// DEBUG
if ( _debug ) alert('mushpup called');
// Get Values
input_key = dom_key.value;
input_check_key = dom_check_key.value;
input_context = dom_context.value;
// Trim Input Fields
trim_key = js_trim(input_key);
trim_check_key = js_trim(input_check_key);
trim_context = js_trim(input_context);
// DEBUG
if ( _debug ) alert('input key: ' + input_key);
if ( _debug ) alert('trim_check_key: ' + trim_check_key);
// Check Keys
if ( (trim_check_key != '__^skip$__') && (trim_key != trim_check_key) )
{
alert("your mushpup secret words didn't match. carefully re-enter them.");
return;
}
// Empty Warnings
if ( trim_key == "" ) alert('Warning: the mushpup secret word you entered is blank.');
if ( trim_context == "" ) alert('Warning: the url you entered is blank.');
// Concatenate
salt = trim_context + trim_key;
if ( _debug ) alert('salt: ' + salt);
// Prepare Hash
// Computer Hash
raw_hash = mushpup_sha24(salt);
// Style Hash
styled_hash = mushpup_style_hash(raw_hash);
// Add Hash Ruler
_hash_html = add_hash_ruler(styled_hash);
// Change Display
// Hide Form Block
dom_no_display_id("mushpup_form_parent");
// Display Hash Block
dom_display_id("hash_stack", "block");
// Print Hash
dom_set_id_html("hash_block", _hash_html);
// *** RETURN
return raw_hash;
} // end Fx
/*____________________________________________________________________________*/
// mushpup_reset_form
/*____________________________________________________________________________*/
function mushpup_style_hash(raw_hash)
{
// *** DATA
// Inline Styles
var _hash0 = 'padding:4px 0; background:#eef; color:#fff; border-top:1px solid #F00; border-bottom:1px solid #00F; border-width:1px 0;';
var _hash1 = 'padding:4px 0; background:#fff; color:#eef; border-top:1px solid #F00; border-bottom:1px solid #00F; border-width:1px 0;';
// Return
var styled_hash = '';
// *** MANIPULATE
styled_hash += ( '' + raw_hash.substr(0,8) + "" );
styled_hash += ( '' + raw_hash.substr(8,8) + "" );
styled_hash += ( '' + raw_hash.substr(16,8) + "" );
styled_hash += ( '' + raw_hash.substr(24,8) + "" );
// *** RETURN
return styled_hash;
} // end Fx
/*____________________________________________________________________________*/
// mushpup_show_passkey_confirm
/*____________________________________________________________________________*/
function mushpup_show_passkey_confirm(show)
{
// *** DATA
// Block IDs
var id1 = "confirm_activate";
var id2 = "passkey_confirm";
var confirm_field = "passkey_confirm_input";
// Return
// Void
// *** MANIPULATE
// Hide Activate Link
// Show Input Field
if ( show )
{
dom_no_display_id(id1);
dom_display_id(id2, "block");
dom_form_set_value(confirm_field, "");
}
else
{
dom_no_display_id(id2);
dom_display_id(id1, "block");
dom_form_set_value(confirm_field, "__^skip$__");
}
// *** RETURN
return;
} // end Fx
/*____________________________________________________________________________*/
// mushpup_reset_form
/*____________________________________________________________________________*/
function mushpup_reset_form()
{
// *** DATA
// *** MANIPULATE
// Clear Form Fields
dom_form_set_value("mushpup_passkey", "");
dom_form_set_value("site", "");
// Reset Toggles
mushpup_show_passkey_confirm(0);
dom_no_display_id("hash_stack");
// *** RETURN
return;
} // end Fx
/*____________________________________________________________________________*/
// mushpup_reset_mirror
/*____________________________________________________________________________*/
function mushpup_reset_mirror()
{
// *** DATA
// *** MANIPULATE
mushpup_reset_form();
dom_display_id("mushpup_form_parent");
// *** RETURN
return;
} // end Fx
/*____________________________________________________________________________*/
// get_hash_display
/*____________________________________________________________________________*/
function add_hash_ruler(the_hash)
{
// *** DATA
// Return
var hash_html = '';
// *** MANIPULATE
// Label
hash_html = '
your password is somewhere in here (copy and paste as needed):
';
// Case Open Div
hash_html += '
';
// Top Ruler
hash_html += '
';
hash_html += '
1 1 2
';
hash_html += '
>...5....0....5....0...>
';
hash_html += '
';
// Bottom Ruler
hash_html += '
';
hash_html += '
2 1 1
';
hash_html += '
<...0....5....0....5...<
';
hash_html += '
';
// The Hash
hash_html += '
' + the_hash + '
';
// Case Close Div
hash_html += '
';
// *** RETURN
return hash_html;
} // end Fx
/*____________________________________________________________________________*/
/*** LICENSE (http://www.opensource.org/licenses/bsd-license.php)
Copyright (c) 2006, Tom Atwell (klenwell@gmail.com)
Wired Jaw Technologies (http://www.wiredjawtech.com/)
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of Wired Jaw Technologies nor the names of its contributors
may be used to endorse or promote products derived from this software without
specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
OF THE POSSIBILITY OF SUCH DAMAGE.
______________________________________________________________________________*/