A variety of hashing functions - jiva
<?php | |
/* | |
A variety of hashing functions - jiva | |
*/ | |
?> | |
<html> | |
<head> | |
<title>Hasher</title> | |
<style type="text/css"> | |
p.def | |
{ | |
font-family:Courier New,Tahoma,Arial,Verdana; | |
font-size:80%; | |
font-weight:bold; | |
color:#00FF00; | |
} | |
input, option, select | |
{ | |
font-family:Courier New,Tahoma,Arial,Verdana; | |
font-size:80%; | |
font-weight:bold; | |
color: #000000; | |
background: #00FF00; | |
border: 1px dotted #035403 | |
} | |
textarea | |
{ | |
font-family:Courier New,Tahoma,Arial,Verdana; | |
font-size:70%; | |
font-weight:bold; | |
color: #00FF00; | |
background: #022102; | |
border: 1px dotted #035403 | |
} | |
.submit input | |
{ | |
color: #000000; | |
background: #00FF00; | |
border: 2px outset #035403 | |
} | |
</style> | |
<script type="text/javascript"> | |
/*jslint onevar: false, plusplus: false */ | |
/* | |
JS Beautifier | |
--------------- | |
Written by Einar Lielmanis, <einar@jsbeautifier.org> | |
http://jsbeautifier.org/ | |
Originally converted to javascript by Vital, <vital76@gmail.com> | |
You are free to use this in any way you want, in case you find this useful or working for you. | |
Usage: | |
js_beautify(js_source_text); | |
js_beautify(js_source_text, options); | |
The options are: | |
indent_size (default 4) — indentation size, | |
indent_char (default space) — character to indent with, | |
preserve_newlines (default true) — whether existing line breaks should be preserved, | |
indent_level (default 0) — initial indentation level, you probably won't need this ever, | |
space_after_anon_function (default false) — if true, then space is added between "function ()" | |
(jslint is happy about this); if false, then the common "function()" output is used. | |
braces_on_own_line (default false) - ANSI / Allman brace style, each opening/closing brace gets its own line. | |
e.g | |
js_beautify(js_source_text, {indent_size: 1, indent_char: '\t'}); | |
*/ | |
function js_beautify(js_source_text, options) { | |
var input, output, token_text, last_type, last_text, last_last_text, last_word, flags, flag_store, indent_string; | |
var whitespace, wordchar, punct, parser_pos, line_starters, digits; | |
var prefix, token_type, do_block_just_closed; | |
var wanted_newline, just_added_newline, n_newlines; | |
// Some interpreters have unexpected results with foo = baz || bar; | |
options = options ? options : {}; | |
var opt_braces_on_own_line = options.braces_on_own_line ? options.braces_on_own_line : false; | |
var opt_indent_size = options.indent_size ? options.indent_size : 4; | |
var opt_indent_char = options.indent_char ? options.indent_char : ' '; | |
var opt_preserve_newlines = typeof options.preserve_newlines === 'undefined' ? true : options.preserve_newlines; | |
var opt_indent_level = options.indent_level ? options.indent_level : 0; // starting indentation | |
var opt_space_after_anon_function = options.space_after_anon_function === 'undefined' ? false : options.space_after_anon_function; | |
var opt_keep_array_indentation = typeof options.keep_array_indentation === 'undefined' ? false : options.keep_array_indentation; | |
just_added_newline = false; | |
// cache the source's length. | |
var input_length = js_source_text.length; | |
function trim_output() { | |
while (output.length && (output[output.length - 1] === ' ' || output[output.length - 1] === indent_string)) { | |
output.pop(); | |
} | |
} | |
function is_array(mode) { | |
return mode === '[EXPRESSION]' || mode === '[INDENTED-EXPRESSION]'; | |
} | |
function trim(s) { | |
return s.replace(/^\s\s*|\s\s*$/, ''); | |
} | |
function print_newline(ignore_repeated) { | |
flags.eat_next_space = false; | |
if (opt_keep_array_indentation && is_array(flags.mode)) { | |
return; | |
} | |
ignore_repeated = typeof ignore_repeated === 'undefined' ? true : ignore_repeated; | |
flags.if_line = false; | |
trim_output(); | |
if (!output.length) { | |
return; // no newline on start of file | |
} | |
if (output[output.length - 1] !== "\n" || !ignore_repeated) { | |
just_added_newline = true; | |
output.push("\n"); | |
} | |
for (var i = 0; i < flags.indentation_level; i += 1) { | |
output.push(indent_string); | |
} | |
if (flags.var_line && flags.var_line_reindented) { | |
if (opt_indent_char === ' ') { | |
output.push(' '); // var_line always pushes 4 spaces, so that the variables would be one under another | |
} else { | |
output.push(indent_string); // skip space-stuffing, if indenting with a tab | |
} | |
} | |
} | |
function print_single_space() { | |
if (flags.eat_next_space) { | |
flags.eat_next_space = false; | |
return; | |
} | |
var last_output = ' '; | |
if (output.length) { | |
last_output = output[output.length - 1]; | |
} | |
if (last_output !== ' ' && last_output !== '\n' && last_output !== indent_string) { // prevent occassional duplicate space | |
output.push(' '); | |
} | |
} | |
function print_token() { | |
just_added_newline = false; | |
flags.eat_next_space = false; | |
output.push(token_text); | |
} | |
function indent() { | |
flags.indentation_level += 1; | |
} | |
function remove_indent() { | |
if (output.length && output[output.length - 1] === indent_string) { | |
output.pop(); | |
} | |
} | |
function set_mode(mode) { | |
if (flags) { | |
flag_store.push(flags); | |
} | |
flags = { | |
previous_mode: flags ? flags.mode : 'BLOCK', | |
mode: mode, | |
var_line: false, | |
var_line_tainted: false, | |
var_line_reindented: false, | |
in_html_comment: false, | |
if_line: false, | |
in_case: false, | |
eat_next_space: false, | |
indentation_baseline: -1, | |
indentation_level: (flags ? flags.indentation_level + ((flags.var_line && flags.var_line_reindented) ? 1 : 0) : opt_indent_level) | |
}; | |
} | |
function is_array(mode) { | |
return mode === '[EXPRESSION]' || mode === '[INDENTED-EXPRESSION]'; | |
} | |
function is_expression(mode) { | |
return mode === '[EXPRESSION]' || mode === '[INDENTED-EXPRESSION]' || mode === '(EXPRESSION)'; | |
} | |
function restore_mode() { | |
do_block_just_closed = flags.mode === 'DO_BLOCK'; | |
if (flag_store.length > 0) { | |
flags = flag_store.pop(); | |
} | |
} | |
function in_array(what, arr) { | |
for (var i = 0; i < arr.length; i += 1) { | |
if (arr[i] === what) { | |
return true; | |
} | |
} | |
return false; | |
} | |
// Walk backwards from the colon to find a '?' (colon is part of a ternary op) | |
// or a '{' (colon is part of a class literal). Along the way, keep track of | |
// the blocks and expressions we pass so we only trigger on those chars in our | |
// own level, and keep track of the colons so we only trigger on the matching '?'. | |
function is_ternary_op() { | |
var level = 0, | |
colon_count = 0; | |
for (var i = output.length - 1; i >= 0; i--) { | |
switch (output[i]) { | |
case ':': | |
if (level === 0) { | |
colon_count++; | |
} | |
break; | |
case '?': | |
if (level === 0) { | |
if (colon_count === 0) { | |
return true; | |
} else { | |
colon_count--; | |
} | |
} | |
break; | |
case '{': | |
if (level === 0) { | |
return false; | |
} | |
level--; | |
break; | |
case '(': | |
case '[': | |
level--; | |
break; | |
case ')': | |
case ']': | |
case '}': | |
level++; | |
break; | |
} | |
} | |
} | |
function get_next_token() { | |
n_newlines = 0; | |
if (parser_pos >= input_length) { | |
return ['', 'TK_EOF']; | |
} | |
wanted_newline = false; | |
var c = input.charAt(parser_pos); | |
parser_pos += 1; | |
var keep_whitespace = opt_keep_array_indentation && is_array(flags.mode); | |
if (keep_whitespace) { | |
// | |
// slight mess to allow nice preservation of array indentation and reindent that correctly | |
// first time when we get to the arrays: | |
// var a = [ | |
// ....'something' | |
// we make note of whitespace_count = 4 into flags.indentation_baseline | |
// so we know that 4 whitespaces in original source match indent_level of reindented source | |
// | |
// and afterwards, when we get to | |
// 'something, | |
// .......'something else' | |
// we know that this should be indented to indent_level + (7 - indentation_baseline) spaces | |
// | |
var whitespace_count = 0; | |
while (in_array(c, whitespace)) { | |
if (c === "\n") { | |
trim_output(); | |
output.push("\n"); | |
just_added_newline = true; | |
whitespace_count = 0; | |
} else { | |
if (c === '\t') { | |
whitespace_count += 4; | |
} else { | |
whitespace_count += 1; | |
} | |
} | |
if (parser_pos >= input_length) { | |
return ['', 'TK_EOF']; | |
} | |
c = input.charAt(parser_pos); | |
parser_pos += 1; | |
} | |
if (flags.indentation_baseline === -1) { | |
flags.indentation_baseline = whitespace_count; | |
} | |
if (just_added_newline) { | |
var i; | |
for (i = 0; i < flags.indentation_level + 1; i += 1) { | |
output.push(indent_string); | |
} | |
if (flags.indentation_baseline !== -1) { | |
for (i = 0; i < whitespace_count - flags.indentation_baseline; i++) { | |
output.push(' '); | |
} | |
} | |
} | |
} else { | |
while (in_array(c, whitespace)) { | |
if (c === "\n") { | |
n_newlines += 1; | |
} | |
if (parser_pos >= input_length) { | |
return ['', 'TK_EOF']; | |
} | |
c = input.charAt(parser_pos); | |
parser_pos += 1; | |
} | |
if (opt_preserve_newlines) { | |
if (n_newlines > 1) { | |
for (i = 0; i < n_newlines; i += 1) { | |
print_newline(i === 0); | |
just_added_newline = true; | |
} | |
} | |
} | |
wanted_newline = n_newlines > 0; | |
} | |
if (in_array(c, wordchar)) { | |
if (parser_pos < input_length) { | |
while (in_array(input.charAt(parser_pos), wordchar)) { | |
c += input.charAt(parser_pos); | |
parser_pos += 1; | |
if (parser_pos === input_length) { | |
break; | |
} | |
} | |
} | |
// small and surprisingly unugly hack for 1E-10 representation | |
if (parser_pos !== input_length && c.match(/^[0-9]+[Ee]$/) && (input.charAt(parser_pos) === '-' || input.charAt(parser_pos) === '+')) { | |
var sign = input.charAt(parser_pos); | |
parser_pos += 1; | |
var t = get_next_token(parser_pos); | |
c += sign + t[0]; | |
return [c, 'TK_WORD']; | |
} | |
if (c === 'in') { // hack for 'in' operator | |
return [c, 'TK_OPERATOR']; | |
} | |
if (wanted_newline && last_type !== 'TK_OPERATOR' && !flags.if_line && (opt_preserve_newlines || last_text !== 'var')) { | |
print_newline(); | |
} | |
return [c, 'TK_WORD']; | |
} | |
if (c === '(' || c === '[') { | |
return [c, 'TK_START_EXPR']; | |
} | |
if (c === ')' || c === ']') { | |
return [c, 'TK_END_EXPR']; | |
} | |
if (c === '{') { | |
return [c, 'TK_START_BLOCK']; | |
} | |
if (c === '}') { | |
return [c, 'TK_END_BLOCK']; | |
} | |
if (c === ';') { | |
return [c, 'TK_SEMICOLON']; | |
} | |
if (c === '/') { | |
var comment = ''; | |
// peek for comment /* ... */ | |
var inline_comment = true; | |
if (input.charAt(parser_pos) === '*') { | |
parser_pos += 1; | |
if (parser_pos < input_length) { | |
while (! (input.charAt(parser_pos) === '*' && input.charAt(parser_pos + 1) && input.charAt(parser_pos + 1) === '/') && parser_pos < input_length) { | |
c = input.charAt(parser_pos); | |
comment += c; | |
if (c === '\x0d' || c === '\x0a') { | |
inline_comment = false; | |
} | |
parser_pos += 1; | |
if (parser_pos >= input_length) { | |
break; | |
} | |
} | |
} | |
parser_pos += 2; | |
if (inline_comment) { | |
return ['/*' + comment + '*/', 'TK_INLINE_COMMENT']; | |
} else { | |
return ['/*' + comment + '*/', 'TK_BLOCK_COMMENT']; | |
} | |
} | |
// peek for comment // ... | |
if (input.charAt(parser_pos) === '/') { | |
comment = c; | |
while (input.charAt(parser_pos) !== "\x0d" && input.charAt(parser_pos) !== "\x0a") { | |
comment += input.charAt(parser_pos); | |
parser_pos += 1; | |
if (parser_pos >= input_length) { | |
break; | |
} | |
} | |
parser_pos += 1; | |
if (wanted_newline) { | |
print_newline(); | |
} | |
return [comment, 'TK_COMMENT']; | |
} | |
} | |
if (c === "'" || // string | |
c === '"' || // string | |
(c === '/' && ((last_type === 'TK_WORD' && in_array(last_text, ['return', 'do'])) || (last_type === 'TK_START_EXPR' || last_type === 'TK_START_BLOCK' || last_type === 'TK_END_BLOCK' || last_type === 'TK_OPERATOR' || last_type === 'TK_EQUALS' || last_type === 'TK_EOF' || last_type === 'TK_SEMICOLON')))) { // regexp | |
var sep = c; | |
var esc = false; | |
var resulting_string = c; | |
if (parser_pos < input_length) { | |
if (sep === '/') { | |
// | |
// handle regexp separately... | |
// | |
var in_char_class = false; | |
while (esc || in_char_class || input.charAt(parser_pos) !== sep) { | |
resulting_string += input.charAt(parser_pos); | |
if (!esc) { | |
esc = input.charAt(parser_pos) === '\\'; | |
if (input.charAt(parser_pos) === '[') { | |
in_char_class = true; | |
} else if (input.charAt(parser_pos) === ']') { | |
in_char_class = false; | |
} | |
} else { | |
esc = false; | |
} | |
parser_pos += 1; | |
if (parser_pos >= input_length) { | |
// incomplete string/rexp when end-of-file reached. | |
// bail out with what had been received so far. | |
return [resulting_string, 'TK_STRING']; | |
} | |
} | |
} else { | |
// | |
// and handle string also separately | |
// | |
while (esc || input.charAt(parser_pos) !== sep) { | |
resulting_string += input.charAt(parser_pos); | |
if (!esc) { | |
esc = input.charAt(parser_pos) === '\\'; | |
} else { | |
esc = false; | |
} | |
parser_pos += 1; | |
if (parser_pos >= input_length) { | |
// incomplete string/rexp when end-of-file reached. | |
// bail out with what had been received so far. | |
return [resulting_string, 'TK_STRING']; | |
} | |
} | |
} | |
} | |
parser_pos += 1; | |
resulting_string += sep; | |
if (sep === '/') { | |
// regexps may have modifiers /regexp/MOD , so fetch those, too | |
while (parser_pos < input_length && in_array(input.charAt(parser_pos), wordchar)) { | |
resulting_string += input.charAt(parser_pos); | |
parser_pos += 1; | |
} | |
} | |
return [resulting_string, 'TK_STRING']; | |
} | |
if (c === '#') { | |
// Spidermonkey-specific sharp variables for circular references | |
// https://developer.mozilla.org/En/Sharp_variables_in_JavaScript | |
// http://mxr.mozilla.org/mozilla-central/source/js/src/jsscan.cpp around line 1935 | |
var sharp = '#'; | |
if (parser_pos < input_length && in_array(input.charAt(parser_pos), digits)) { | |
do { | |
c = input.charAt(parser_pos); | |
sharp += c; | |
parser_pos += 1; | |
} while (parser_pos < input_length && c !== '#' && c !== '='); | |
if (c === '#') { | |
// | |
} else if (input.charAt(parser_pos) === '[' && input.charAt(parser_pos + 1) === ']') { | |
sharp += '[]'; | |
parser_pos += 2; | |
} else if (input.charAt(parser_pos) === '{' && input.charAt(parser_pos + 1) === '}') { | |
sharp += '{}'; | |
parser_pos += 2; | |
} | |
return [sharp, 'TK_WORD']; | |
} | |
} | |
if (c === '<' && input.substring(parser_pos - 1, parser_pos + 3) === '<!--') { | |
parser_pos += 3; | |
flags.in_html_comment = true; | |
return ['<!--', 'TK_COMMENT']; | |
} | |
if (c === '-' && flags.in_html_comment && input.substring(parser_pos - 1, parser_pos + 2) === '-->') { | |
flags.in_html_comment = false; | |
parser_pos += 2; | |
if (wanted_newline) { | |
print_newline(); | |
} | |
return ['-->', 'TK_COMMENT']; | |
} | |
if (in_array(c, punct)) { | |
while (parser_pos < input_length && in_array(c + input.charAt(parser_pos), punct)) { | |
c += input.charAt(parser_pos); | |
parser_pos += 1; | |
if (parser_pos >= input_length) { | |
break; | |
} | |
} | |
if (c === '=') { | |
return [c, 'TK_EQUALS']; | |
} else { | |
return [c, 'TK_OPERATOR']; | |
} | |
} | |
return [c, 'TK_UNKNOWN']; | |
} | |
//---------------------------------- | |
indent_string = ''; | |
while (opt_indent_size > 0) { | |
indent_string += opt_indent_char; | |
opt_indent_size -= 1; | |
} | |
input = js_source_text; | |
last_word = ''; // last 'TK_WORD' passed | |
last_type = 'TK_START_EXPR'; // last token type | |
last_text = ''; // last token text | |
last_last_text = ''; // pre-last token text | |
output = []; | |
do_block_just_closed = false; | |
whitespace = "\n\r\t ".split(''); | |
wordchar = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_$'.split(''); | |
digits = '0123456789'.split(''); | |
punct = '+ - * / % & ++ -- = += -= *= /= %= == === != !== > < >= <= >> << >>> >>>= >>= <<= && &= | || ! !! , : ? ^ ^= |= ::'.split(' '); | |
// words which should always start on new line. | |
line_starters = 'continue,try,throw,return,var,if,switch,case,default,for,while,break,function'.split(','); | |
// states showing if we are currently in expression (i.e. "if" case) - 'EXPRESSION', or in usual block (like, procedure), 'BLOCK'. | |
// some formatting depends on that. | |
flag_store = []; | |
set_mode('BLOCK'); | |
parser_pos = 0; | |
while (true) { | |
var t = get_next_token(parser_pos); | |
token_text = t[0]; | |
token_type = t[1]; | |
if (token_type === 'TK_EOF') { | |
break; | |
} | |
switch (token_type) { | |
case 'TK_START_EXPR': | |
if (token_text === '[') { | |
if (last_type === 'TK_WORD' || last_text === ')') { | |
// this is array index specifier, break immediately | |
// a[x], fn()[x] | |
if (in_array(last_text, line_starters)) { | |
print_single_space(); | |
} | |
set_mode('(EXPRESSION)'); | |
print_token(); | |
break; | |
} | |
if (flags.mode === '[EXPRESSION]' || flags.mode === '[INDENTED-EXPRESSION]') { | |
if (last_last_text === ']' && last_text === ',') { | |
// ], [ goes to new line | |
if (flags.mode === '[EXPRESSION]') { | |
flags.mode = '[INDENTED-EXPRESSION]'; | |
if (!opt_keep_array_indentation) { | |
indent(); | |
} | |
} | |
set_mode('[EXPRESSION]'); | |
if (!opt_keep_array_indentation) { | |
print_newline(); | |
} | |
} else if (last_text === '[') { | |
if (flags.mode === '[EXPRESSION]') { | |
flags.mode = '[INDENTED-EXPRESSION]'; | |
if (!opt_keep_array_indentation) { | |
indent(); | |
} | |
} | |
set_mode('[EXPRESSION]'); | |
if (!opt_keep_array_indentation) { | |
print_newline(); | |
} | |
} else { | |
set_mode('[EXPRESSION]'); | |
} | |
} else { | |
set_mode('[EXPRESSION]'); | |
} | |
} else { | |
set_mode('(EXPRESSION)'); | |
} | |
if (last_text === ';' || last_type === 'TK_START_BLOCK') { | |
print_newline(); | |
} else if (last_type === 'TK_END_EXPR' || last_type === 'TK_START_EXPR' || last_type === 'TK_END_BLOCK' || last_text === '.') { | |
// do nothing on (( and )( and ][ and ]( and .( | |
} else if (last_type !== 'TK_WORD' && last_type !== 'TK_OPERATOR') { | |
print_single_space(); | |
} else if (last_word === 'function') { | |
// function() vs function () | |
if (opt_space_after_anon_function) { | |
print_single_space(); | |
} | |
} else if (in_array(last_text, line_starters) || last_text === 'catch') { | |
print_single_space(); | |
} | |
print_token(); | |
break; | |
case 'TK_END_EXPR': | |
if (token_text === ']') { | |
if (opt_keep_array_indentation) { | |
if (last_text === '}') { | |
// trim_output(); | |
// print_newline(true); | |
remove_indent(); | |
print_token(); | |
restore_mode(); | |
break; | |
} | |
} else { | |
if (flags.mode === '[INDENTED-EXPRESSION]') { | |
if (last_text === ']') { | |
restore_mode(); | |
print_newline(); | |
print_token(); | |
break; | |
} | |
} | |
} | |
} | |
restore_mode(); | |
print_token(); | |
break; | |
case 'TK_START_BLOCK': | |
if (last_word === 'do') { | |
set_mode('DO_BLOCK'); | |
} else { | |
set_mode('BLOCK'); | |
} | |
if (opt_braces_on_own_line) { | |
if (last_type !== 'TK_OPERATOR') { | |
if (last_text == 'return') { | |
print_single_space(); | |
} else { | |
print_newline(true); | |
} | |
} | |
print_token(); | |
indent(); | |
} else { | |
if (last_type !== 'TK_OPERATOR' && last_type !== 'TK_START_EXPR') { | |
if (last_type === 'TK_START_BLOCK') { | |
print_newline(); | |
} else { | |
print_single_space(); | |
} | |
} else { | |
// if TK_OPERATOR or TK_START_EXPR | |
if (is_array(flags.previous_mode) && last_text === ',') { | |
print_newline(); // [a, b, c, { | |
} | |
} | |
indent(); | |
print_token(); | |
} | |
break; | |
case 'TK_END_BLOCK': | |
restore_mode(); | |
if (opt_braces_on_own_line) { | |
print_newline(); | |
print_token(); | |
} else { | |
if (last_type === 'TK_START_BLOCK') { | |
// nothing | |
if (just_added_newline) { | |
remove_indent(); | |
} else { | |
// {} | |
trim_output(); | |
} | |
} else { | |
print_newline(); | |
} | |
print_token(); | |
} | |
break; | |
case 'TK_WORD': | |
// no, it's not you. even I have problems understanding how this works | |
// and what does what. | |
if (do_block_just_closed) { | |
// do {} ## while () | |
print_single_space(); | |
print_token(); | |
print_single_space(); | |
do_block_just_closed = false; | |
break; | |
} | |
if (token_text === 'function') { | |
if ((just_added_newline || last_text === ';') && last_text !== '{') { | |
// make sure there is a nice clean space of at least one blank line | |
// before a new function definition | |
n_newlines = just_added_newline ? n_newlines : 0; | |
for (var i = 0; i < 2 - n_newlines; i++) { | |
print_newline(false); | |
} | |
} | |
} | |
if (token_text === 'case' || token_text === 'default') { | |
if (last_text === ':') { | |
// switch cases following one another | |
remove_indent(); | |
} else { | |
// case statement starts in the same line where switch | |
flags.indentation_level--; | |
print_newline(); | |
flags.indentation_level++; | |
} | |
print_token(); | |
flags.in_case = true; | |
break; | |
} | |
prefix = 'NONE'; | |
if (last_type === 'TK_END_BLOCK') { | |
if (!in_array(token_text.toLowerCase(), ['else', 'catch', 'finally'])) { | |
prefix = 'NEWLINE'; | |
} else { | |
if (opt_braces_on_own_line) { | |
prefix = 'NEWLINE'; | |
} else { | |
prefix = 'SPACE'; | |
print_single_space(); | |
} | |
} | |
} else if (last_type === 'TK_SEMICOLON' && (flags.mode === 'BLOCK' || flags.mode === 'DO_BLOCK')) { | |
prefix = 'NEWLINE'; | |
} else if (last_type === 'TK_SEMICOLON' && is_expression(flags.mode)) { | |
prefix = 'SPACE'; | |
} else if (last_type === 'TK_STRING') { | |
prefix = 'NEWLINE'; | |
} else if (last_type === 'TK_WORD') { | |
prefix = 'SPACE'; | |
} else if (last_type === 'TK_START_BLOCK') { | |
prefix = 'NEWLINE'; | |
} else if (last_type === 'TK_END_EXPR') { | |
print_single_space(); | |
prefix = 'NEWLINE'; | |
} | |
if (last_type !== 'TK_END_BLOCK' && in_array(token_text.toLowerCase(), ['else', 'catch', 'finally'])) { | |
print_newline(); | |
} else if (in_array(token_text, line_starters) || prefix === 'NEWLINE') { | |
if (last_text === 'else') { | |
// no need to force newline on else break | |
print_single_space(); | |
} else if ((last_type === 'TK_START_EXPR' || last_text === '=' || last_text === ',') && token_text === 'function') { | |
// no need to force newline on 'function': (function | |
// DONOTHING | |
} else if (last_text === 'return' || last_text === 'throw') { | |
// no newline between 'return nnn' | |
print_single_space(); | |
} else if (last_type !== 'TK_END_EXPR') { | |
if ((last_type !== 'TK_START_EXPR' || token_text !== 'var') && last_text !== ':') { | |
// no need to force newline on 'var': for (var x = 0...) | |
if (token_text === 'if' && last_word === 'else' && last_text !== '{') { | |
// no newline for } else if { | |
print_single_space(); | |
} else { | |
print_newline(); | |
} | |
} | |
} else { | |
if (in_array(token_text, line_starters) && last_text !== ')') { | |
print_newline(); | |
} | |
} | |
} else if (is_array(flags.mode) && last_text === ',' && last_last_text === '}') { | |
print_newline(); // }, in lists get a newline treatment | |
} else if (prefix === 'SPACE') { | |
print_single_space(); | |
} | |
print_token(); | |
last_word = token_text; | |
if (token_text === 'var') { | |
flags.var_line = true; | |
flags.var_line_reindented = false; | |
flags.var_line_tainted = false; | |
} | |
if (token_text === 'if' || token_text === 'else') { | |
flags.if_line = true; | |
} | |
break; | |
case 'TK_SEMICOLON': | |
print_token(); | |
flags.var_line = false; | |
flags.var_line_reindented = false; | |
break; | |
case 'TK_STRING': | |
if (last_type === 'TK_START_BLOCK' || last_type === 'TK_END_BLOCK' || last_type === 'TK_SEMICOLON') { | |
print_newline(); | |
} else if (last_type === 'TK_WORD') { | |
print_single_space(); | |
} | |
print_token(); | |
break; | |
case 'TK_EQUALS': | |
if (flags.var_line) { | |
// just got an '=' in a var-line, different formatting/line-breaking, etc will now be done | |
flags.var_line_tainted = true; | |
} | |
print_single_space(); | |
print_token(); | |
print_single_space(); | |
break; | |
case 'TK_OPERATOR': | |
var space_before = true; | |
var space_after = true; | |
if (flags.var_line && token_text === ',' && (is_expression(flags.mode))) { | |
// do not break on comma, for(var a = 1, b = 2) | |
flags.var_line_tainted = false; | |
} | |
if (flags.var_line) { | |
if (token_text === ',') { | |
if (flags.var_line_tainted) { | |
print_token(); | |
flags.var_line_reindented = true; | |
flags.var_line_tainted = false; | |
print_newline(); | |
break; | |
} else { | |
flags.var_line_tainted = false; | |
} | |
// } else if (token_text === ':') { | |
// hmm, when does this happen? tests don't catch this | |
// flags.var_line = false; | |
} | |
} | |
if (last_text === 'return' || last_text === 'throw') { | |
// "return" had a special handling in TK_WORD. Now we need to return the favor | |
print_single_space(); | |
print_token(); | |
break; | |
} | |
if (token_text === ':' && flags.in_case) { | |
print_token(); // colon really asks for separate treatment | |
print_newline(); | |
flags.in_case = false; | |
break; | |
} | |
if (token_text === '::') { | |
// no spaces around exotic namespacing syntax operator | |
print_token(); | |
break; | |
} | |
if (token_text === ',') { | |
if (flags.var_line) { | |
if (flags.var_line_tainted) { | |
print_token(); | |
print_newline(); | |
flags.var_line_tainted = false; | |
} else { | |
print_token(); | |
print_single_space(); | |
} | |
} else if (last_type === 'TK_END_BLOCK' && flags.mode !== "(EXPRESSION)") { | |
print_token(); | |
if (flags.mode === 'OBJECT' && last_text === '}') { | |
print_newline(); | |
} else { | |
print_single_space(); | |
} | |
} else { | |
if (flags.mode === 'OBJECT') { | |
print_token(); | |
print_newline(); | |
} else { | |
// EXPR or DO_BLOCK | |
print_token(); | |
print_single_space(); | |
} | |
} | |
break; | |
// } else if (in_array(token_text, ['--', '++', '!']) || (in_array(token_text, ['-', '+']) && (in_array(last_type, ['TK_START_BLOCK', 'TK_START_EXPR', 'TK_EQUALS']) || in_array(last_text, line_starters) || in_array(last_text, ['==', '!=', '+=', '-=', '*=', '/=', '+', '-'])))) { | |
} else if (in_array(token_text, ['--', '++', '!']) || (in_array(token_text, ['-', '+']) && (in_array(last_type, ['TK_START_BLOCK', 'TK_START_EXPR', 'TK_EQUALS', 'TK_OPERATOR']) || in_array(last_text, line_starters)))) { | |
// unary operators (and binary +/- pretending to be unary) special cases | |
space_before = false; | |
space_after = false; | |
if (last_text === ';' && is_expression(flags.mode)) { | |
// for (;; ++i) | |
// ^^^ | |
space_before = true; | |
} | |
if (last_type === 'TK_WORD' && in_array(last_text, line_starters)) { | |
space_before = true; | |
} | |
if (flags.mode === 'BLOCK' && (last_text === '{' || last_text === ';')) { | |
// { foo; --i } | |
// foo(); --bar; | |
print_newline(); | |
} | |
} else if (token_text === '.') { | |
// decimal digits or object.property | |
space_before = false; | |
} else if (token_text === ':') { | |
if (!is_ternary_op()) { | |
flags.mode = 'OBJECT'; | |
space_before = false; | |
} | |
} | |
if (space_before) { | |
print_single_space(); | |
} | |
print_token(); | |
if (space_after) { | |
print_single_space(); | |
} | |
if (token_text === '!') { | |
// flags.eat_next_space = true; | |
} | |
break; | |
case 'TK_BLOCK_COMMENT': | |
var lines = token_text.split(/\x0a|\x0d\x0a/); | |
if (/^\/\*\*/.test(token_text)) { | |
// javadoc: reformat and reindent | |
print_newline(); | |
output.push(lines[0]); | |
for (i = 1; i < lines.length; i++) { | |
print_newline(); | |
output.push(' '); | |
output.push(trim(lines[i])); | |
} | |
} else { | |
// simple block comment: leave intact | |
if (lines.length > 1) { | |
// multiline comment block starts with a new line | |
print_newline(); | |
} else { | |
// single-line /* comment */ stays where it is | |
print_single_space(); | |
} | |
for (i = 0; i < lines.length; i++) { | |
if (i > 0) { | |
output.push(' '); | |
} | |
output.push(trim(lines[i])); | |
print_newline(); | |
} | |
} | |
print_newline(); | |
break; | |
case 'TK_INLINE_COMMENT': | |
print_single_space(); | |
print_token(); | |
if (is_expression(flags.mode)) { | |
print_single_space(); | |
} else { | |
print_newline(); | |
} | |
break; | |
case 'TK_COMMENT': | |
// print_newline(); | |
if (wanted_newline) { | |
print_newline(); | |
} else { | |
print_single_space(); | |
} | |
print_token(); | |
print_newline(); | |
break; | |
case 'TK_UNKNOWN': | |
print_token(); | |
break; | |
} | |
last_last_text = last_text; | |
last_type = token_type; | |
last_text = token_text; | |
} | |
return output.join('').replace(/[\n ]+$/, ''); | |
} | |
// Add support for CommonJS. Just put this file somewhere on your require.paths | |
// and you will be able to `var js_beautify = require("beautify").js_beautify`. | |
if (typeof exports !== "undefined") | |
exports.js_beautify = js_beautify; | |
</script> | |
<script type="text/javascript"> | |
/* | |
Style HTML | |
--------------- | |
Written by Nochum Sossonko, (nsossonko@hotmail.com) | |
Based on code initially developed by: Einar Lielmanis, <elfz@laacz.lv> | |
http://jsbeautifier.org | |
You are free to use this in any way you want, in case you find this useful or working for you. | |
Usage: | |
style_html(html_source); | |
*/ | |
function style_html(html_source, indent_size, indent_character, max_char) { | |
//Wrapper function to invoke all the necessary constructors and deal with the output. | |
var Parser, multi_parser; | |
function Parser() { | |
this.pos = 0; //Parser position | |
this.token = ''; | |
this.current_mode = 'CONTENT'; //reflects the current Parser mode: TAG/CONTENT | |
this.tags = { //An object to hold tags, their position, and their parent-tags, initiated with default values | |
parent: 'parent1', | |
parentcount: 1, | |
parent1: '' | |
}; | |
this.tag_type = ''; | |
this.token_text = this.last_token = this.last_text = this.token_type = ''; | |
this.Utils = { //Uilities made available to the various functions | |
whitespace: "\n\r\t ".split(''), | |
single_token: 'br,input,link,meta,!doctype,basefont,base,area,hr,wbr,param,img,isindex,?xml,embed'.split(','), //all the single tags for HTML | |
extra_liners: 'head,body,/html'.split(','), //for tags that need a line of whitespace before them | |
in_array: function (what, arr) { | |
for (var i=0; i<arr.length; i++) { | |
if (what === arr[i]) { | |
return true; | |
} | |
} | |
return false; | |
} | |
} | |
this.get_content = function () { //function to capture regular content between tags | |
var input_char = ''; | |
var content = []; | |
var space = false; //if a space is needed | |
while (this.input.charAt(this.pos) !== '<') { | |
if (this.pos >= this.input.length) { | |
return content.length?content.join(''):['', 'TK_EOF']; | |
} | |
input_char = this.input.charAt(this.pos); | |
this.pos++; | |
this.line_char_count++; | |
if (this.Utils.in_array(input_char, this.Utils.whitespace)) { | |
if (content.length) { | |
space = true; | |
} | |
this.line_char_count--; | |
continue; //don't want to insert unnecessary space | |
} | |
else if (space) { | |
if (this.line_char_count >= this.max_char) { //insert a line when the max_char is reached | |
content.push('\n'); | |
for (var i=0; i<this.indent_level; i++) { | |
content.push(this.indent_string); | |
} | |
this.line_char_count = 0; | |
} | |
else{ | |
content.push(' '); | |
this.line_char_count++; | |
} | |
space = false; | |
} | |
content.push(input_char); //letter at-a-time (or string) inserted to an array | |
} | |
return content.length?content.join(''):''; | |
} | |
this.get_script = function () { //get the full content of a script to pass to js_beautify | |
var input_char = ''; | |
var content = []; | |
var reg_match = new RegExp('\<\/script' + '\>', 'igm'); | |
reg_match.lastIndex = this.pos; | |
var reg_array = reg_match.exec(this.input); | |
var end_script = reg_array?reg_array.index:this.input.length; //absolute end of script | |
while(this.pos < end_script) { //get everything in between the script tags | |
if (this.pos >= this.input.length) { | |
return content.length?content.join(''):['', 'TK_EOF']; | |
} | |
input_char = this.input.charAt(this.pos); | |
this.pos++; | |
content.push(input_char); | |
} | |
return content.length?content.join(''):''; //we might not have any content at all | |
} | |
this.record_tag = function (tag){ //function to record a tag and its parent in this.tags Object | |
if (this.tags[tag + 'count']) { //check for the existence of this tag type | |
this.tags[tag + 'count']++; | |
this.tags[tag + this.tags[tag + 'count']] = this.indent_level; //and record the present indent level | |
} | |
else { //otherwise initialize this tag type | |
this.tags[tag + 'count'] = 1; | |
this.tags[tag + this.tags[tag + 'count']] = this.indent_level; //and record the present indent level | |
} | |
this.tags[tag + this.tags[tag + 'count'] + 'parent'] = this.tags.parent; //set the parent (i.e. in the case of a div this.tags.div1parent) | |
this.tags.parent = tag + this.tags[tag + 'count']; //and make this the current parent (i.e. in the case of a div 'div1') | |
} | |
this.retrieve_tag = function (tag) { //function to retrieve the opening tag to the corresponding closer | |
if (this.tags[tag + 'count']) { //if the openener is not in the Object we ignore it | |
var temp_parent = this.tags.parent; //check to see if it's a closable tag. | |
while (temp_parent) { //till we reach '' (the initial value); | |
if (tag + this.tags[tag + 'count'] === temp_parent) { //if this is it use it | |
break; | |
} | |
temp_parent = this.tags[temp_parent + 'parent']; //otherwise keep on climbing up the DOM Tree | |
} | |
if (temp_parent) { //if we caught something | |
this.indent_level = this.tags[tag + this.tags[tag + 'count']]; //set the indent_level accordingly | |
this.tags.parent = this.tags[temp_parent + 'parent']; //and set the current parent | |
} | |
delete this.tags[tag + this.tags[tag + 'count'] + 'parent']; //delete the closed tags parent reference... | |
delete this.tags[tag + this.tags[tag + 'count']]; //...and the tag itself | |
if (this.tags[tag + 'count'] == 1) { | |
delete this.tags[tag + 'count']; | |
} | |
else { | |
this.tags[tag + 'count']--; | |
} | |
} | |
} | |
this.get_tag = function () { //function to get a full tag and parse its type | |
var input_char = ''; | |
var content = []; | |
var space = false; | |
do { | |
if (this.pos >= this.input.length) { | |
return content.length?content.join(''):['', 'TK_EOF']; | |
} | |
input_char = this.input.charAt(this.pos); | |
this.pos++; | |
this.line_char_count++; | |
if (this.Utils.in_array(input_char, this.Utils.whitespace)) { //don't want to insert unnecessary space | |
space = true; | |
this.line_char_count--; | |
continue; | |
} | |
if (input_char === "'" || input_char === '"') { | |
if (!content[1] || content[1] !== '!') { //if we're in a comment strings don't get treated specially | |
input_char += this.get_unformatted(input_char); | |
space = true; | |
} | |
} | |
if (input_char === '=') { //no space before = | |
space = false; | |
} | |
if (content.length && content[content.length-1] !== '=' && input_char !== '>' | |
&& space) { //no space after = or before > | |
if (this.line_char_count >= this.max_char) { | |
this.print_newline(false, content); | |
this.line_char_count = 0; | |
} | |
else { | |
content.push(' '); | |
this.line_char_count++; | |
} | |
space = false; | |
} | |
content.push(input_char); //inserts character at-a-time (or string) | |
} while (input_char !== '>'); | |
var tag_complete = content.join(''); | |
var tag_index; | |
if (tag_complete.indexOf(' ') != -1) { //if there's whitespace, thats where the tag name ends | |
tag_index = tag_complete.indexOf(' '); | |
} | |
else { //otherwise go with the tag ending | |
tag_index = tag_complete.indexOf('>'); | |
} | |
var tag_check = tag_complete.substring(1, tag_index).toLowerCase(); | |
if (tag_complete.charAt(tag_complete.length-2) === '/' || | |
this.Utils.in_array(tag_check, this.Utils.single_token)) { //if this tag name is a single tag type (either in the list or has a closing /) | |
this.tag_type = 'SINGLE'; | |
} | |
else if (tag_check === 'script') { //for later script handling | |
this.record_tag(tag_check); | |
this.tag_type = 'SCRIPT'; | |
} | |
else if (tag_check === 'style') { //for future style handling (for now it justs uses get_content) | |
this.record_tag(tag_check); | |
this.tag_type = 'STYLE'; | |
} | |
else if (tag_check === 'a') { // do not reformat the <a> links | |
var comment = this.get_unformatted('</a>', tag_complete); //...delegate to get_unformatted function | |
content.push(comment); | |
this.tag_type = 'SINGLE'; | |
} | |
else if (tag_check.charAt(0) === '!') { //peek for <!-- comment | |
if (tag_check.indexOf('[if') != -1) { //peek for <!--[if conditional comment | |
if (tag_complete.indexOf('!IE') != -1) { //this type needs a closing --> so... | |
var comment = this.get_unformatted('-->', tag_complete); //...delegate to get_unformatted | |
content.push(comment); | |
} | |
this.tag_type = 'START'; | |
} | |
else if (tag_check.indexOf('[endif') != -1) {//peek for <!--[endif end conditional comment | |
this.tag_type = 'END'; | |
this.unindent(); | |
} | |
else if (tag_check.indexOf('[cdata[') != -1) { //if it's a <[cdata[ comment... | |
var comment = this.get_unformatted(']]>', tag_complete); //...delegate to get_unformatted function | |
content.push(comment); | |
this.tag_type = 'SINGLE'; //<![CDATA[ comments are treated like single tags | |
} | |
else { | |
var comment = this.get_unformatted('-->', tag_complete); | |
content.push(comment); | |
this.tag_type = 'SINGLE'; | |
} | |
} | |
else { | |
if (tag_check.charAt(0) === '/') { //this tag is a double tag so check for tag-ending | |
this.retrieve_tag(tag_check.substring(1)); //remove it and all ancestors | |
this.tag_type = 'END'; | |
} | |
else { //otherwise it's a start-tag | |
this.record_tag(tag_check); //push it on the tag stack | |
this.tag_type = 'START'; | |
} | |
if (this.Utils.in_array(tag_check, this.Utils.extra_liners)) { //check if this double needs an extra line | |
this.print_newline(true, this.output); | |
} | |
} | |
return content.join(''); //returns fully formatted tag | |
} | |
this.get_unformatted = function (delimiter, orig_tag) { //function to return unformatted content in its entirety | |
if (orig_tag && orig_tag.indexOf(delimiter) != -1) { | |
return ''; | |
} | |
var input_char = ''; | |
var content = ''; | |
var space = true; | |
do { | |
if (this.pos >= this.input.length) { | |
return content; | |
} | |
input_char = this.input.charAt(this.pos); | |
this.pos++ | |
if (this.Utils.in_array(input_char, this.Utils.whitespace)) { | |
if (!space) { | |
this.line_char_count--; | |
continue; | |
} | |
if (input_char === '\n' || input_char === '\r') { | |
content += '\n'; | |
for (var i=0; i<this.indent_level; i++) { | |
content += this.indent_string; | |
} | |
space = false; //...and make sure other indentation is erased | |
this.line_char_count = 0; | |
continue; | |
} | |
} | |
content += input_char; | |
this.line_char_count++; | |
space = true; | |
} while (content.indexOf(delimiter) == -1); | |
return content; | |
} | |
this.get_token = function () { //initial handler for token-retrieval | |
var token; | |
if (this.last_token === 'TK_TAG_SCRIPT') { //check if we need to format javascript | |
var temp_token = this.get_script(); | |
if (typeof temp_token !== 'string') { | |
return temp_token; | |
} | |
token = js_beautify(temp_token, | |
{indent_size: this.indent_size, indent_char: this.indent_character, indent_level: this.indent_level}); //call the JS Beautifier | |
return [token, 'TK_CONTENT']; | |
} | |
if (this.current_mode === 'CONTENT') { | |
token = this.get_content(); | |
if (typeof token !== 'string') { | |
return token; | |
} | |
else { | |
return [token, 'TK_CONTENT']; | |
} | |
} | |
if(this.current_mode === 'TAG') { | |
token = this.get_tag(); | |
if (typeof token !== 'string') { | |
return token; | |
} | |
else { | |
var tag_name_type = 'TK_TAG_' + this.tag_type; | |
return [token, tag_name_type]; | |
} | |
} | |
} | |
this.printer = function (js_source, indent_character, indent_size, max_char) { //handles input/output and some other printing functions | |
this.input = js_source || ''; //gets the input for the Parser | |
this.output = []; | |
this.indent_character = indent_character || ' '; | |
this.indent_string = ''; | |
this.indent_size = indent_size || 2; | |
this.indent_level = 0; | |
this.max_char = max_char || 70; //maximum amount of characters per line | |
this.line_char_count = 0; //count to see if max_char was exceeded | |
for (var i=0; i<this.indent_size; i++) { | |
this.indent_string += this.indent_character; | |
} | |
this.print_newline = function (ignore, arr) { | |
this.line_char_count = 0; | |
if (!arr || !arr.length) { | |
return; | |
} | |
if (!ignore) { //we might want the extra line | |
while (this.Utils.in_array(arr[arr.length-1], this.Utils.whitespace)) { | |
arr.pop(); | |
} | |
} | |
arr.push('\n'); | |
for (var i=0; i<this.indent_level; i++) { | |
arr.push(this.indent_string); | |
} | |
} | |
this.print_token = function (text) { | |
this.output.push(text); | |
} | |
this.indent = function () { | |
this.indent_level++; | |
} | |
this.unindent = function () { | |
if (this.indent_level > 0) { | |
this.indent_level--; | |
} | |
} | |
} | |
return this; | |
} | |
/*_____________________--------------------_____________________*/ | |
multi_parser = new Parser(); //wrapping functions Parser | |
multi_parser.printer(html_source, indent_character, indent_size); //initialize starting values | |
while (true) { | |
var t = multi_parser.get_token(); | |
multi_parser.token_text = t[0]; | |
multi_parser.token_type = t[1]; | |
if (multi_parser.token_type === 'TK_EOF') { | |
break; | |
} | |
switch (multi_parser.token_type) { | |
case 'TK_TAG_START': case 'TK_TAG_SCRIPT': case 'TK_TAG_STYLE': | |
multi_parser.print_newline(false, multi_parser.output); | |
multi_parser.print_token(multi_parser.token_text); | |
multi_parser.indent(); | |
multi_parser.current_mode = 'CONTENT'; | |
break; | |
case 'TK_TAG_END': | |
multi_parser.print_newline(true, multi_parser.output); | |
multi_parser.print_token(multi_parser.token_text); | |
multi_parser.current_mode = 'CONTENT'; | |
break; | |
case 'TK_TAG_SINGLE': | |
multi_parser.print_newline(false, multi_parser.output); | |
multi_parser.print_token(multi_parser.token_text); | |
multi_parser.current_mode = 'CONTENT'; | |
break; | |
case 'TK_CONTENT': | |
if (multi_parser.token_text !== '') { | |
multi_parser.print_newline(false, multi_parser.output); | |
multi_parser.print_token(multi_parser.token_text); | |
} | |
multi_parser.current_mode = 'TAG'; | |
break; | |
} | |
multi_parser.last_token = multi_parser.token_type; | |
multi_parser.last_text = multi_parser.token_text; | |
} | |
return multi_parser.output.join(''); | |
} | |
</script> | |
<script type="text/javascript"> | |
// | |
// trivial bookmarklet/escaped script detector for the javascript beautifier | |
// written by Einar Lielmanis <einar@jsbeautifier.org> | |
// | |
// usage: | |
// | |
// if (EscapedBookmarklet.detect(some_string)) { | |
// var unpacked = EscapedBookmarklet.unpack(some_string); | |
// } | |
// | |
// | |
var EscapedBookmarklet = { | |
detect: function (str) { | |
// the fact that script doesn't contain any space, but has %20 instead | |
// should be sufficient check for now. | |
// not that sufficient, should check for spaces - jiva | |
return str.indexOf('%20') != -1 && str.indexOf(' ') == -1; | |
}, | |
unpack: function (str) { | |
if (EscapedBookmarklet.detect(str)) { | |
return unescape(str); | |
} | |
return str; | |
}, | |
run_tests: function (sanity_test) { | |
var t = sanity_test || new SanityTest(); | |
t.test_function(EscapedBookmarklet.detect, "EscapedBookmarklet.detect"); | |
t.expect('', false); | |
t.expect('var a = b', false); | |
t.expect('var%20a=b', true); | |
t.test_function(EscapedBookmarklet.unpack, 'EscapedBookmarklet.unpack'); | |
t.expect('', ''); | |
t.expect('abcd', 'abcd'); | |
t.expect('var a = b', 'var a = b'); | |
t.expect('var%20a=b', 'var a=b'); | |
return t; | |
} | |
} | |
</script> | |
<script type="text/javascript"> | |
// | |
// simple unpacker/deobfuscator for scripts messed up with javascriptobfuscator.com | |
// written by Einar Lielmanis <einar@jsbeautifier.org> | |
// | |
// usage: | |
// | |
// if (JavascriptObfuscator.detect(some_string)) { | |
// var unpacked = JavascriptObfuscator.unpack(some_string); | |
// } | |
// | |
// | |
var JavascriptObfuscator = { | |
detect: function (str) { | |
return /^var _0x[a-f0-9]+ ?\= ?\[/.test(str); | |
}, | |
unpack: function (str) { | |
if (JavascriptObfuscator.detect(str)) { | |
var matches = /var (_0x[a-f\d]+) ?\= ?\[(.*?)\];/.exec(str); | |
if (matches) { | |
var var_name = matches[1]; | |
var strings = JavascriptObfuscator._smart_split(matches[2]); | |
var str = str.substring(matches[0].length); | |
for (var k in strings) { | |
str = str.replace(new RegExp(var_name + '\\[' + k + '\\]', 'g'), | |
JavascriptObfuscator._fix_quotes(JavascriptObfuscator._unescape(strings[k]))); | |
} | |
} | |
} | |
return str; | |
}, | |
_fix_quotes: function(str) { | |
var matches = /^"(.*)"$/.exec(str); | |
if (matches) { | |
str = matches[1]; | |
str = "'" + str.replace(/'/g, "\\'") + "'"; | |
} | |
return str; | |
}, | |
_smart_split: function(str) { | |
var strings = []; | |
var pos = 0; | |
while (pos < str.length) { | |
if (str.charAt(pos) == '"') { | |
// new word | |
var word = ''; | |
pos += 1; | |
while (pos < str.length) { | |
if (str.charAt(pos) == '"') { | |
break; | |
} | |
if (str.charAt(pos) == '\\') { | |
word += '\\'; | |
pos++; | |
} | |
word += str.charAt(pos); | |
pos++; | |
} | |
strings.push('"' + word + '"'); | |
} | |
pos += 1; | |
} | |
return strings; | |
}, | |
_unescape: function (str) { | |
// inefficient if used repeatedly or on small strings, but wonderful on single large chunk of text | |
for (var i = 32; i < 128; i++) { | |
str = str.replace(new RegExp('\\\\x' + i.toString(16), 'ig'), String.fromCharCode(i)); | |
} | |
return str; | |
}, | |
run_tests: function (sanity_test) { | |
var t = sanity_test || new SanityTest(); | |
t.test_function(JavascriptObfuscator._smart_split, "JavascriptObfuscator._smart_split"); | |
t.expect('', []); | |
t.expect('"a", "b"', ['"a"', '"b"']); | |
t.expect('"aaa","bbbb"', ['"aaa"', '"bbbb"']); | |
t.expect('"a", "b\\\""', ['"a"', '"b\\\""']); | |
t.test_function(JavascriptObfuscator._unescape, 'JavascriptObfuscator._unescape'); | |
t.expect('\\x40', '@'); | |
t.expect('\\x10', '\\x10'); | |
t.expect('\\x1', '\\x1'); | |
t.expect("\\x61\\x62\\x22\\x63\\x64", 'ab"cd'); | |
t.test_function(JavascriptObfuscator.detect, 'JavascriptObfuscator.detect'); | |
t.expect('', false); | |
t.expect('abcd', false); | |
t.expect('var _0xaaaa', false); | |
t.expect('var _0xaaaa = ["a", "b"]', true); | |
t.expect('var _0xaaaa=["a", "b"]', true); | |
t.expect('var _0x1234=["a","b"]', true); | |
return t; | |
} | |
} | |
</script> | |
<script type="text/javascript"> | |
// | |
// Unpacker for Dean Edward's p.a.c.k.e.r, a part of javascript beautifier | |
// written by Einar Lielmanis <einar@jsbeautifier.org> | |
// | |
// Coincidentally, it can defeat a couple of other eval-based compressors. | |
// | |
// usage: | |
// | |
// if (P_A_C_K_E_R.detect(some_string)) { | |
// var unpacked = P_A_C_K_E_R.unpack(some_string); | |
// } | |
// | |
// | |
var P_A_C_K_E_R = { | |
detect: function (str) { | |
return P_A_C_K_E_R._starts_with(str.toLowerCase().replace(/ +/g, ''), 'eval(function(') || | |
P_A_C_K_E_R._starts_with(str.toLowerCase().replace(/ +/g, ''), 'eval((function(') ; | |
}, | |
unpack: function (str) { | |
var unpacked_source = ''; | |
if (P_A_C_K_E_R.detect(str)) { | |
try { | |
eval('unpacked_source = ' + str.substring(4) + ';') | |
if (typeof unpacked_source == 'string' && unpacked_source) { | |
str = unpacked_source; | |
} | |
} catch (error) { | |
// well, it failed. we'll just return the original, instead of crashing on user. | |
} | |
} | |
return str; | |
}, | |
_starts_with: function (str, what) { | |
return str.substr(0, what.length) === what; | |
}, | |
run_tests: function (sanity_test) { | |
var t = sanity_test || new SanityTest(); | |
t.test_function(P_A_C_K_E_R.detect, "P_A_C_K_E_R.detect"); | |
t.expect('', false); | |
t.expect('var a = b', false); | |
t.expect('eval(function(p,a,c,k,e,r', true); | |
t.expect('eval ( function(p, a, c, k, e, r', true); | |
t.test_function(P_A_C_K_E_R.unpack, 'P_A_C_K_E_R.unpack'); | |
t.expect("eval(function(p,a,c,k,e,r){e=String;if(!''.replace(/^/,String)){while(c--)r[c]=k[c]||c;k=[function(e){return r[e]}];e=function(){return'\\\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\\\b'+e(c)+'\\\\b','g'),k[c]);return p}('0 2=1',3,3,'var||a'.split('|'),0,{}))", | |
'var a=1'); | |
var starts_with_a = function(what) { return P_A_C_K_E_R._starts_with(what, 'a'); } | |
t.test_function(starts_with_a, "P_A_C_K_E_R._starts_with(?, a)"); | |
t.expect('abc', true); | |
t.expect('bcd', false); | |
t.expect('a', true); | |
t.expect('', false); | |
return t; | |
} | |
} | |
</script> | |
<script type="text/javascript"> | |
function flip() | |
{ | |
var x = document.getElementsByName('x')[0].value; | |
var y = document.getElementsByName('y')[0].value; | |
document.getElementsByName('x')[0].value = y; | |
document.getElementsByName('y')[0].value = x; | |
} | |
function helper(type) | |
{ | |
if(type == 1) | |
{ | |
document.getElementsByName('y')[0].value = style_html(document.getElementsByName('x')[0].value); | |
} | |
if(type == 2) | |
{ | |
document.getElementsByName('y')[0].value = js_beautify(document.getElementsByName('x')[0].value); | |
} | |
if(type == 3) | |
{ | |
if(EscapedBookmarklet.detect(document.getElementsByName('x')[0].value)) | |
{ | |
var unpacked = EscapedBookmarklet.unpack(document.getElementsByName('x')[0].value); | |
document.getElementsByName('y')[0].value = unpacked; | |
} | |
else | |
{ | |
document.getElementsByName('y')[0].value = "No bookmarklet detected."; | |
} | |
} | |
if(type == 4) | |
{ | |
if(JavascriptObfuscator.detect(document.getElementsByName('x')[0].value)) | |
{ | |
var unpacked = JavascriptObfuscator.unpack(document.getElementsByName('x')[0].value); | |
document.getElementsByName('y')[0].value = unpacked; | |
} | |
else | |
{ | |
document.getElementsByName('y')[0].value = "Can not detect javascriptobfuscator.com obfuscation"; | |
} | |
} | |
if(type == 5) | |
{ | |
if(P_A_C_K_E_R.detect(document.getElementsByName('x')[0].value)) | |
{ | |
var unpacked = P_A_C_K_E_R.unpack(document.getElementsByName('x')[0].value); | |
document.getElementsByName('y')[0].value = unpacked; | |
} | |
else | |
{ | |
document.getElementsByName('y')[0].value = "Can not detect p.a.c.k.e.r obfuscation"; | |
} | |
} | |
if(type == 6) | |
{ | |
document.getElementsByName('y')[0].value = escape(document.getElementsByName('x')[0].value); | |
} | |
if(type == 7) | |
{ | |
document.getElementsByName('y')[0].value = unescape(document.getElementsByName('x')[0].value); | |
} | |
} | |
</script> | |
<script type="text/javascript"> | |
function rotn(_text, _shift) | |
{ | |
var res = ''; | |
for(var i=0; i < _text.length; i++) | |
{ | |
var chr = _text[i]; | |
var x = chr.charCodeAt(0); | |
if(97<=x && x<=122 || 65<=x && x<=90) | |
{ | |
x = x + parseInt(_shift); | |
var offset = 65; | |
if(97<=chr.charCodeAt(0) && chr.charCodeAt(0)<=122) | |
{ | |
offset = 97; | |
} | |
while(x < offset) | |
{ | |
x = x+26; | |
} | |
while(x > offset+25) | |
{ | |
x = x-26; | |
} | |
res += String.fromCharCode(x); | |
} | |
else | |
{ | |
res += chr; | |
} | |
} | |
return res; | |
} | |
function rotn_helper() | |
{ | |
var _text = document.getElementsByName('x')[0].value; | |
var _shift = document.getElementById('rot').options[document.getElementById('rot').selectedIndex].text; | |
if(document.getElementById('rot').value == 'all') | |
{ | |
for(var i = 1; i < 27; i++) | |
{ | |
document.getElementsByName('y')[0].value += i + ': ' + rotn(_text,i) + "\n"; | |
} | |
} | |
else if(document.getElementById('rot').value == '') | |
{ | |
document.getElementsByName('y')[0].value = "Enter numeric value for rot, or \"all\""; | |
} | |
else | |
{ | |
document.getElementsByName('y')[0].value = rotn(_text,_shift); | |
} | |
} | |
</script> | |
<script type="text/javascript"> | |
var _gaq = _gaq || []; | |
_gaq.push(['_setAccount', 'UA-31103568-1']); | |
_gaq.push(['_trackPageview']); | |
(function() { | |
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; | |
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; | |
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); | |
})(); | |
</script> | |
</head> | |
<body bgcolor="black"> | |
<center> | |
<font size="-3"> | |
<pre><font color=#010000>00</font><font color=#000001>1</font><font color=black>0</font><font color=#000001>0</font><font color=#000101>0</font><font color=#000001>1</font><font color=black>01</font><font color=#010001>1</font><font color=#000001>1</font><font color=#000101>1</font><font color=black>01011111001110011101001101011</font><font color=#000001>00</font><font color=#020000>0</font><font color=#010002>1</font><font color=#010001>1</font><font color=#010100>0</font><font color=#010001>1</font><font color=black>111110111111110000101001111010100110010100100101101</font><font color=#010202>0</font><font color=#050907>1</font><font color=#0b4e0a>1</font><font color=#129c14>0</font><font color=#0ea80d>1</font><font color=#168b16>1</font><font color=#0a3a0c>1</font><font color=#040404>0</font><font color=#010101>1</font><font color=#000001>0</font><font color=black>10011010101</font><br><font color=#060202>1</font><font color=#040202>0</font><font color=#010203>1</font><font color=#020202>1</font><font color=#020302>0</font><font color=#030407>1</font><font color=#020206>1</font><font color=#010102>0</font><font color=#020302>1</font><font color=#020405>1</font><font color=#010304>1</font><font color=#040304>0</font><font color=#020202>1</font><font color=black>0000101100100101110101000111</font><font color=#030102>1</font><font color=#020304>0</font><font color=#070205>1</font><font color=#030508>0</font><font color=#030504>0</font><font color=#050304>0</font><font color=#040204>1</font><font color=black>001010111110111011001001001100011000100011010101100</font><font color=#030103>1</font><font color=#0f4713>1</font><font color=#0dee10>1</font><font color=#04fc06>0</font><font color=#00ff02>0</font><font color=#05fc05>1</font><font color=#11e011>1</font><font color=#0b280a>0</font><font color=#030202>0</font><font color=#020002>0</font><font color=black>00001010001</font><br><font color=#070303>1</font><font color=#09240b>0</font><font color=#0b3f0e>1</font><font color=#0c3f10>0</font><font color=#09400a>1</font><font color=#0b1908>0</font><font color=#040405>1</font><font color=#040204>0</font><font color=#112f11>0</font><font color=#0c400d>1</font><font color=#0a4009>1</font><font color=#0b3e0b>1</font><font color=#090f0b>0</font><font color=black>010001</font><font color=#010000>0</font><font color=#000100>01</font><font color=black>1111001010</font><font color=#000001>0</font><font color=black>0</font><font color=#010002>1</font><font color=#000002>1</font><font color=#000001>1</font><font color=#000100>0</font><font color=black>100</font><font color=#020101>1</font><font color=#030107>0</font><font color=#081e08>0</font><font color=#188219>0</font><font color=#13a415>1</font><font color=#18791a>1</font><font color=#060507>0</font><font color=#000101>0</font><font color=#010001>10</font><font color=#000100>00</font><font color=black>11010101</font><font color=#000001>01</font><font color=#010002>01</font><font color=#000001>0</font><font color=black>00010100101111</font><font color=#000100>0</font><font color=#000001>0</font><font color=#000002>0</font><font color=black>0011101000000011</font><font color=#020302>0</font><font color=#135114>1</font><font color=#0df20e>1</font><font color=#03fd07>1</font><font color=#00ff04>1</font><font color=#05fc04>0</font><font color=#11e70f>1</font><font color=#092f0b>0</font><font color=#020204>1</font><font color=#010002>1</font><font color=black>01001101111</font><br><font color=#05050a>1</font><font color=#103811>0</font><font color=#189c1c>0</font><font color=#13b416>0</font><font color=#106214>0</font><font color=#0d2315>1</font><font color=#020703>1</font><font color=#070307>0</font><font color=#134b13>1</font><font color=#126614>1</font><font color=#1ddd1f>1</font><font color=#106813>1</font><font color=#091409>0</font><font color=black>101101</font><font color=#010103>1</font><font color=#030103>0</font><font color=#030104>0</font><font color=#010001>0</font><font color=black>000100011</font><font color=#010005>0</font><font color=#010201>0</font><font color=#020503>0</font><font color=#010303>0</font><font color=#030102>0</font><font color=#060103>1</font><font color=#030101>0</font><font color=black>111</font><font color=#010001>1</font><font color=#020402>0</font><font color=#051306>1</font><font color=#117210>1</font><font color=#189818>0</font><font color=#020306>0</font><font color=#040207>0</font><font color=#020207>0</font><font color=#010203>0</font><font color=#010201>0</font><font color=#020102>1</font><font color=#010101>1</font><font color=#000100>0</font><font color=black>10000</font><font color=#000001>1</font><font color=#010102>1</font><font color=#010201>0</font><font color=#020403>11</font><font color=#010101>0</font><font color=#020002>1</font><font color=#010001>1</font><font color=black>001101111010</font><font color=#060204>1</font><font color=#040201>0</font><font color=#020103>0</font><font color=black>1100100110010100</font><font color=#010102>1</font><font color=#070e09>0</font><font color=#107012>0</font><font color=#12bc13>0</font><font color=#10d710>0</font><font color=#15b315>1</font><font color=#0c570d>0</font><font color=#020703>0</font><font color=#020004>0</font><font color=#000101>0</font><font color=black>11111011000</font><br><font color=#060203>0</font><font color=#040404>0</font><font color=#136916>0</font><font color=#109613>1</font><font color=#010602>1</font><font color=#050404>0</font><font color=#06020a>0</font><font color=#010202>1</font><font color=#040403>1</font><font color=#020d04>0</font><font color=#28e425>0</font><font color=#020f04>0</font><font color=#040204>0</font><font color=black>001</font><font color=#000200>1</font><font color=#010601>1</font><font color=#041c05>0</font><font color=#0c350b>1</font><font color=#0c410b>0</font><font color=#0d420b>0</font><font color=#0a3309>0</font><font color=#051205>1</font><font color=#010200>0</font><font color=#010002>1</font><font color=black>111</font><font color=#010002>0</font><font color=#010201>0</font><font color=#010103>1</font><font color=#010804>0</font><font color=#0a250b>0</font><font color=#0c400c>1</font><font color=#0d4410>0</font><font color=#0b3f0d>1</font><font color=#082a08>1</font><font color=#040d03>0</font><font color=#061206>0</font><font color=#010000>00</font><font color=black>11</font><font color=#000100>1</font><font color=#0e660e>0</font><font color=#179817>0</font><font color=#030507>0</font><font color=#0b2109>1</font><font color=#09410b>0</font><font color=#0e420d>0</font><font color=#0a3e0a>1</font><font color=#061e07>0</font><font color=#030202>1</font><font color=#010200>0</font><font color=black>11</font><font color=#000100>1</font><font color=#020002>1</font><font color=#010202>1</font><font color=#020302>0</font><font color=#030d05>0</font><font color=#0a2e09>0</font><font color=#0f420f>1</font><font color=#0f4410>0</font><font color=#0b3809>0</font><font color=#041c04>0</font><font color=#020302>1</font><font color=#000201>0</font><font color=#020002>1</font><font color=#000100>1</font><font color=black>10</font><font color=#000002>0</font><font color=#061506>1</font><font color=#071b07>0</font><font color=#071c08>0</font><font color=#061205>0</font><font color=#010201>0</font><font color=#020202>0</font><font color=#081808>1</font><font color=#083e09>1</font><font color=#104111>1</font><font color=#082008>0</font><font color=#020204>1</font><font color=#000001>0</font><font color=black>1001110111101</font><font color=#000202>1</font><font color=#010102>1</font><font color=#030102>1</font><font color=#030502>1</font><font color=#030604>1</font><font color=#020306>0</font><font color=#020203>1</font><font color=#010002>0</font><font color=#000002>0</font><font color=#010101>1</font><font color=#010001>0</font><font color=#010102>0</font><font color=#010101>0</font><font color=#020202>1</font><font color=#020100>1</font><font color=#000101>1</font><font color=black>10000</font><br><font color=#010103>1</font><font color=#040302>1</font><font color=#136913>0</font><font color=#129712>0</font><font color=#080307>1</font><font color=#050403>0</font><font color=#020405>0</font><font color=#030204>1</font><font color=#040105>1</font><font color=#010c03>1</font><font color=#22e721>1</font><font color=#011204>1</font><font color=#030205>0</font><font color=black>00</font><font color=#010000>1</font><font color=#0c1c0c>0</font><font color=#198d1d>1</font><font color=#118e0e>0</font><font color=#0d7911>0</font><font color=#106611>0</font><font color=#0d660e>1</font><font color=#0e8212>1</font><font color=#13a314>0</font><font color=#0b4d0d>0</font><font color=#030406>1</font><font color=black>10</font><font color=#000100>1</font><font color=#020105>1</font><font color=#060502>1</font><font color=#0a2a0a>1</font><font color=#129712>0</font><font color=#118c14>0</font><font color=#0e730f>1</font><font color=#105f13>1</font><font color=#0f6c10>1</font><font color=#108810>0</font><font color=#12a713>0</font><font color=#1b9f1c>0</font><font color=#040503>1</font><font color=#010202>1</font><font color=black>11</font><font color=#000102>1</font><font color=#0d6b08>0</font><font color=#14ae1a>1</font><font color=#148012>1</font><font color=#129712>0</font><font color=#0e7210>1</font><font color=#0e620e>0</font><font color=#117813>1</font><font color=#149c18>0</font><font color=#106c10>1</font><font color=#030906>0</font><font color=black>00</font><font color=#020102>0</font><font color=#060206>1</font><font color=#070f09>0</font><font color=#105211>0</font><font color=#119d12>1</font><font color=#10860e>1</font><font color=#116d11>0</font><font color=#116510>1</font><font color=#117b0d>1</font><font color=#169b15>0</font><font color=#147b13>0</font><font color=#091d09>0</font><font color=#030304>1</font><font color=#000101>0</font><font color=black>00</font><font color=#030303>1</font><font color=#176114>1</font><font color=#108413>1</font><font color=#18a016>1</font><font color=#128211>1</font><font color=#081f0a>1</font><font color=#126c15>0</font><font color=#149f16>0</font><font color=#117a11>1</font><font color=#0f6c12>1</font><font color=#15a214>0</font><font color=#10460f>0</font><font color=#010603>0</font><font color=#030007>0</font><font color=black>010000100101</font><font color=#000001>0</font><font color=black>10</font><font color=#010001>0</font><font color=black>0</font><font color=#000100>1</font><font color=#010001>0</font><font color=black>1</font><font color=#010101>1</font><font color=#020304>1</font><font color=#07260a>0</font><font color=#117211>0</font><font color=#0e9612>1</font><font color=#107f11>0</font><font color=#0d390c>1</font><font color=#040804>1</font><font color=#010101>0</font><font color=black>1111</font><br><font color=#010103>0</font><font color=#040302>0</font><font color=#136913>0</font><font color=#15b816>0</font><font color=#0c5e0e>0</font><font color=#10590f>0</font><font color=#0b5a0b>0</font><font color=#0c590c>1</font><font color=#0b590c>1</font><font color=#0f5f0f>1</font><font color=#24e527>1</font><font color=#011100>0</font><font color=#030101>1</font><font color=black>11</font><font color=#010000>1</font><font color=#050806>0</font><font color=#081107>1</font><font color=#040504>1</font><font color=#010402>1</font><font color=#060303>1</font><font color=#040205>1</font><font color=#060606>1</font><font color=#0a3707>0</font><font color=#1dda27>0</font><font color=#000d03>1</font><font color=black>10</font><font color=#010000>1</font><font color=#040102>1</font><font color=#020405>0</font><font color=#158b18>1</font><font color=#129f14>0</font><font color=#090a06>1</font><font color=#08040b>1</font><font color=#050408>0</font><font color=#040405>0</font><font color=#040802>0</font><font color=#0f500f>0</font><font color=#18a11b>0</font><font color=#040405>0</font><font color=#040202>1</font><font color=black>10</font><font color=#020201>0</font><font color=#10670f>0</font><font color=#0fdb13>1</font><font color=#0e5e0f>1</font><font color=#040e03>1</font><font color=#050304>1</font><font color=#030404>0</font><font color=#070507>0</font><font color=#081708>0</font><font color=#17c214>0</font><font color=#0b480f>1</font><font color=#010101>1</font><font color=black>1</font><font color=#020201>1</font><font color=#070609>0</font><font color=#138712>0</font><font color=#15a216>0</font><font color=#072c09>0</font><font color=#050705>1</font><font color=#040205>0</font><font color=#050405>0</font><font color=#040405>1</font><font color=#061505>1</font><font color=#0d700e>0</font><font color=#17b716>0</font><font color=#071d0b>0</font><font color=#030202>1</font><font color=black>10</font><font color=#020202>0</font><font color=#070208>1</font><font color=#090309>0</font><font color=#16681b>1</font><font color=#12c815>1</font><font color=#18a01b>1</font><font color=#0f6b14>1</font><font color=#061a08>0</font><font color=#040306>1</font><font color=#030205>0</font><font color=#081d08>0</font><font color=#0c280c>1</font><font color=#040407>1</font><font color=#000101>0</font><font color=black>0111000100001001000</font><font color=#010001>1</font><font color=#020202>0</font><font color=#061e07>0</font><font color=#19d018>0</font><font color=#06fb04>1</font><font color=#04fd02>1</font><font color=#04fc05>1</font><font color=#0fe810>1</font><font color=#0f4612>0</font><font color=#020104>0</font><font color=#010101>0</font><font color=black>010</font><br><font color=#010103>1</font><font color=#040302>0</font><font color=#136913>1</font><font color=#18b11a>0</font><font color=#0f4c10>1</font><font color=#0f4710>0</font><font color=#0e470e>0</font><font color=#0e470d>10</font><font color=#0e500e>0</font><font color=#25e628>1</font><font color=#011200>0</font><font color=#040004>0</font><font color=black>10</font><font color=#010000>1</font><font color=#050d05>0</font><font color=#092b08>1</font><font color=#0d4f0d>0</font><font color=#0f5f0f>1</font><font color=#116112>0</font><font color=#115d12>0</font><font color=#0f5a0f>0</font><font color=#0e530c>1</font><font color=#23e723>1</font><font color=#001100>0</font><font color=black>11</font><font color=#010002>0</font><font color=#030101>0</font><font color=#050109>0</font><font color=#0d370d>1</font><font color=#17ad14>1</font><font color=#0e970d>0</font><font color=#0f7a0e>1</font><font color=#116a13>0</font><font color=#0b5b0c>0</font><font color=#0a4609>1</font><font color=#09310e>1</font><font color=#051f07>0</font><font color=#040303>0</font><font color=#040201>0</font><font color=black>10</font><font color=#000100>0</font><font color=#0e660e>0</font><font color=#159e17>0</font><font color=#020506>1</font><font color=black>1</font><font color=#000001>1</font><font color=black>1</font><font color=#020105>1</font><font color=#020204>0</font><font color=#189a15>0</font><font color=#0e670f>1</font><font color=#010201>1</font><font color=#010001>0</font><font color=#020303>1</font><font color=#082b08>1</font><font color=#16e317>1</font><font color=#0c560c>1</font><font color=#093d0c>0</font><font color=#0a3b0c>0</font><font color=#093c0c>1000</font><font color=#09430b>0</font><font color=#14b513>0</font><font color=#117812>1</font><font color=#020402>0</font><font color=black>111</font><font color=#030104>0</font><font color=#020206>0</font><font color=#146917>1</font><font color=#14b614>0</font><font color=#072208>0</font><font color=#09060b>1</font><font color=#010101>0</font><font color=#000001>11</font><font color=#010101>00</font><font color=#010001>1</font><font color=black>1111010100010001001</font><font color=#000100>1</font><font color=#010001>0</font><font color=#020202>0</font><font color=#073208>0</font><font color=#10ec17>0</font><font color=#05fd02>1</font><font color=#05fc04>1</font><font color=#07fb08>1</font><font color=#08f70b>0</font><font color=#0f6113>1</font><font color=#050104>1</font><font color=black>0010</font><br><font color=#010204>0</font><font color=#030202>0</font><font color=#136a14>0</font><font color=#109911>1</font><font color=#070305>1</font><font color=#070204>0</font><font color=#010206>0</font><font color=#020102>1</font><font color=#020103>1</font><font color=#020a02>0</font><font color=#1fe826>0</font><font color=#011002>0</font><font color=#040204>0</font><font color=#010101>1</font><font color=#030202>0</font><font color=#040c04>0</font><font color=#188418>0</font><font color=#12a012>0</font><font color=#107010>0</font><font color=#095408>0</font><font color=#09440d>0</font><font color=#08460b>0</font><font color=#0d520a>1</font><font color=#0c680e>1</font><font color=#23e71f>1</font><font color=#001102>0</font><font color=#010001>0</font><font color=black>0</font><font color=#020101>1</font><font color=#020204>0</font><font color=#090202>1</font><font color=#060406>0</font><font color=#061308>1</font><font color=#0b350a>0</font><font color=#0a4b08>1</font><font color=#0b590a>1</font><font color=#0a660b>1</font><font color=#10820f>1</font><font color=#15a413>1</font><font color=#119411>1</font><font color=#071308>1</font><font color=#050502>1</font><font color=#010000>1</font><font color=#010001>1</font><font color=#010102>0</font><font color=#0f650e>0</font><font color=#179817>1</font><font color=#010305>0</font><font color=#000100>00</font><font color=#000001>1</font><font color=#020006>0</font><font color=#000302>1</font><font color=#179816>1</font><font color=#0d670f>1</font><font color=#010202>0</font><font color=#000101>1</font><font color=#030304>1</font><font color=#0e330a>0</font><font color=#13e717>0</font><font color=#0f6b0f>0</font><font color=#0f630e>10</font><font color=#10630f>0</font><font color=#0f630e>0</font><font color=#0f630f>01</font><font color=#0d6711>1</font><font color=#126512>0</font><font color=#0c440d>1</font><font color=#050204>0</font><font color=black>01</font><font color=#010000>0</font><font color=#040104>1</font><font color=#020207>0</font><font color=#166915>0</font><font color=#0e980f>1</font><font color=#050304>1</font><font color=#050203>0</font><font color=#020000>1</font><font color=#000100>01</font><font color=black>0010011110</font><font color=#000100>01</font><font color=black>1</font><font color=#010001>10</font><font color=black>0</font><font color=#000100>0</font><font color=#010001>0</font><font color=#010000>0</font><font color=black>0</font><font color=#000100>110</font><font color=black>1</font><font color=#010001>0</font><font color=#020704>1</font><font color=#136d17>0</font><font color=#10d015>0</font><font color=#13f314>0</font><font color=#11e013>0</font><font color=#138a16>1</font><font color=#081709>1</font><font color=#010102>1</font><font color=black>0010</font><br><font color=#070205>0</font><font color=#050105>1</font><font color=#166715>1</font><font color=#149513>1</font><font color=#060304>1</font><font color=#070204>0</font><font color=#010304>0</font><font color=#010102>0</font><font color=#030404>0</font><font color=#020e04>0</font><font color=#23e726>1</font><font color=#011107>1</font><font color=#040108>0</font><font color=#030503>0</font><font color=#060303>1</font><font color=#0f580d>0</font><font color=#13ba18>0</font><font color=#060d07>0</font><font color=#060306>1</font><font color=#020204>1</font><font color=#020203>1</font><font color=#070204>1</font><font color=#070606>1</font><font color=#0a380b>1</font><font color=#20e922>0</font><font color=#021204>0</font><font color=#030406>0</font><font color=#020203>1</font><font color=#010201>0</font><font color=#040205>1</font><font color=#081f09>1</font><font color=#147715>1</font><font color=#020802>0</font><font color=#040305>1</font><font color=#040203>0</font><font color=#020204>1</font><font color=#020303>1</font><font color=#040605>1</font><font color=#061208>0</font><font color=#17bb15>0</font><font color=#0f5b0e>1</font><font color=#040206>1</font><font color=#020101>1</font><font color=#030304>0</font><font color=#030504>1</font><font color=#0e6511>0</font><font color=#159918>0</font><font color=#040308>1</font><font color=#020205>1</font><font color=#020201>1</font><font color=#010103>1</font><font color=#040205>1</font><font color=#050304>1</font><font color=#189714>0</font><font color=#0e670e>0</font><font color=#030203>1</font><font color=#060202>0</font><font color=#040504>0</font><font color=#090a0b>1</font><font color=#16ae15>0</font><font color=#127211>1</font><font color=#010f04>0</font><font color=#060307>1</font><font color=#040405>1</font><font color=#020203>0</font><font color=#020303>0</font><font color=#030505>1</font><font color=#050507>0</font><font color=#070e06>0</font><font color=#091705>0</font><font color=#020105>0</font><font color=black>00</font><font color=#010101>0</font><font color=#040303>0</font><font color=#030404>0</font><font color=#156916>0</font><font color=#0f9811>1</font><font color=#040205>0</font><font color=#040306>0</font><font color=#020307>1</font><font color=#030305>0</font><font color=#040304>1</font><font color=#010001>0</font><font color=black>10101101</font><font color=#010101>1</font><font color=#030206>1</font><font color=#030106>1</font><font color=#030203>1</font><font color=#030304>0</font><font color=#030204>1</font><font color=#010002>1</font><font color=#030101>0</font><font color=#020201>0</font><font color=#030303>0</font><font color=#020305>0</font><font color=#020205>1</font><font color=#040206>1</font><font color=#020104>1</font><font color=black>0</font><font color=#010101>0</font><font color=#010102>0</font><font color=#040304>1</font><font color=#070a06>0</font><font color=#05120a>1</font><font color=#060f06>1</font><font color=#080505>0</font><font color=#030204>1</font><font color=#000101>0</font><font color=black>1110</font><br><font color=#090b09>1</font><font color=#103810>0</font><font color=#168718>0</font><font color=#12aa14>1</font><font color=#0f3a10>1</font><font color=#0b1608>1</font><font color=#040305>0</font><font color=#030204>0</font><font color=#0f270f>1</font><font color=#0d410c>0</font><font color=#22e421>1</font><font color=#0a440b>1</font><font color=#0c280b>0</font><font color=#020306>0</font><font color=#050505>1</font><font color=#08340b>1</font><font color=#18c41b>0</font><font color=#0d500a>1</font><font color=#071b09>1</font><font color=#041705>0</font><font color=#081c03>1</font><font color=#0c430e>1</font><font color=#108216>1</font><font color=#13a416>1</font><font color=#1ee71b>0</font><font color=#0b460d>1</font><font color=#0d280f>0</font><font color=#030304>0</font><font color=#030102>1</font><font color=#020409>1</font><font color=#0e340f>1</font><font color=#10e712>1</font><font color=#0e8411>1</font><font color=#0c380b>1</font><font color=#071a04>1</font><font color=#031403>0</font><font color=#041707>0</font><font color=#092e0a>1</font><font color=#137016>0</font><font color=#19b619>0</font><font color=#092507>1</font><font color=#030205>1</font><font color=#050103>1</font><font color=#060d06>0</font><font color=#0f390f>1</font><font color=#178214>0</font><font color=#17aa17>0</font><font color=#0d3a0f>0</font><font color=#061807>0</font><font color=#040204>0</font><font color=#010203>0</font><font color=#071408>1</font><font color=#0d3a10>1</font><font color=#17ab16>1</font><font color=#138414>1</font><font color=#0f3310>0</font><font color=#060b06>0</font><font color=#030307>1</font><font color=#040204>1</font><font color=#08250a>0</font><font color=#169416>0</font><font color=#129212>0</font><font color=#0a450b>0</font><font color=#041e04>0</font><font color=#031303>0</font><font color=#051806>0</font><font color=#0b310a>1</font><font color=#0e600b>0</font><font color=#179918>1</font><font color=#0e5410>1</font><font color=#040207>0</font><font color=black>00</font><font color=#051106>0</font><font color=#0f350f>1</font><font color=#0c390d>1</font><font color=#188319>0</font><font color=#12a914>0</font><font color=#0d380d>1</font><font color=#0e370d>0</font><font color=#0d390d>0</font><font color=#0c390c>0</font><font color=#0d1e0e>0</font><font color=#020103>0</font><font color=black>11001100</font><font color=#030503>1</font><font color=#0a2c08>1</font><font color=#116911>0</font><font color=#137114>1</font><font color=#0b450f>0</font><font color=#070d07>0</font><font color=#030105>1</font><font color=#020102>1</font><font color=#050306>1</font><font color=#072207>1</font><font color=#145e15>0</font><font color=#127412>0</font><font color=#0f5310>0</font><font color=#081608>1</font><font color=#020102>1</font><font color=black>1</font><font color=#030103>0</font><font color=#071608>1</font><font color=#135012>0</font><font color=#107412>1</font><font color=#106112>0</font><font color=#092109>0</font><font color=#050307>1</font><font color=#010102>1</font><font color=black>0001</font><br><font color=#0b1b0c>1</font><font color=#106910>1</font><font color=#0c6a0f>1</font><font color=#096e0a>1</font><font color=#0f6810>0</font><font color=#0e2b0e>0</font><font color=#040304>0</font><font color=#070308>0</font><font color=#125413>1</font><font color=#0d6b0f>0</font><font color=#096c09>1</font><font color=#0c690e>0</font><font color=#0e510e>0</font><font color=#010101>1</font><font color=#010000>1</font><font color=#010101>0</font><font color=#0c280c>1</font><font color=#107510>0</font><font color=#118b11>1</font><font color=#148614>1</font><font color=#118e0f>1</font><font color=#0f7411>0</font><font color=#0b410e>0</font><font color=#040d06>1</font><font color=#106711>0</font><font color=#0e6a0e>1</font><font color=#125016>0</font><font color=#040404>1</font><font color=#040204>1</font><font color=#030404>1</font><font color=#0b150d>0</font><font color=#115813>0</font><font color=#0b470e>0</font><font color=#107b11>1</font><font color=#118c11>0</font><font color=#148512>1</font><font color=#108d10>0</font><font color=#118313>0</font><font color=#0b5c0d>1</font><font color=#0a120d>1</font><font color=#010301>1</font><font color=#020205>0</font><font color=#060105>1</font><font color=#091a08>1</font><font color=#136614>1</font><font color=#0c6a0b>0</font><font color=#0b6a0b>1</font><font color=#0d690e>0</font><font color=#0d2b0f>1</font><font color=#080207>1</font><font color=#040302>0</font><font color=#0d2912>1</font><font color=#0e6a0e>0</font><font color=#0c6a0f>0</font><font color=#0d6a0c>1</font><font color=#0f6812>1</font><font color=#0a170d>1</font><font color=#050202>0</font><font color=black>00</font><font color=#020403>0</font><font color=#0b340d>0</font><font color=#0e750f>1</font><font color=#118f11>0</font><font color=#148612>1</font><font color=#128c10>1</font><font color=#128111>0</font><font color=#0c5c0e>1</font><font color=#092309>0</font><font color=#060404>1</font><font color=#020100>1</font><font color=black>1</font><font color=#010101>1</font><font color=#072807>1</font><font color=#10670f>0</font><font color=#0e690b>0</font><font color=#0c6b09>1</font><font color=#0b6a0b>0</font><font color=#0c6a0c>11</font><font color=#0d690d>1</font><font color=#0d6b0e>1</font><font color=#103e10>0</font><font color=#020203>0</font><font color=black>11010</font><font color=#010000>0</font><font color=#020106>1</font><font color=#040605>0</font><font color=#106113>1</font><font color=#0eee0e>1</font><font color=#04fd03>11</font><font color=#08f90b>0</font><font color=#189f18>0</font><font color=#040805>1</font><font color=#040204>1</font><font color=#0d370e>0</font><font color=#13df15>0</font><font color=#03fc06>0</font><font color=#04fd02>1</font><font color=#06fb06>1</font><font color=#19c915>0</font><font color=#0a1a0a>0</font><font color=#050203>1</font><font color=#051706>1</font><font color=#18c520>0</font><font color=#09f907>0</font><font color=#00ff04>1</font><font color=#03fd04>1</font><font color=#16e016>1</font><font color=#0e390e>1</font><font color=#030104>0</font><font color=black>1000</font><br><font color=#040206>1</font><font color=#040203>1</font><font color=#020103>0</font><font color=#020205>0</font><font color=#040103>1</font><font color=#040105>1</font><font color=#020205>0</font><font color=#020201>0</font><font color=#060304>0</font><font color=#040203>0</font><font color=#030102>1</font><font color=#040102>0</font><font color=#010102>1</font><font color=black>001</font><font color=#030205>1</font><font color=#040604>0</font><font color=#050804>0</font><font color=#020903>0</font><font color=#020802>1</font><font color=#020304>0</font><font color=#030404>1</font><font color=#020306>0</font><font color=#050404>1</font><font color=#040508>1</font><font color=#080402>1</font><font color=#040401>0</font><font color=#050103>0</font><font color=#040402>1</font><font color=#050303>0</font><font color=#030203>1</font><font color=#040205>1</font><font color=#020503>1</font><font color=#040a03>0</font><font color=#030a04>0</font><font color=#010904>0</font><font color=#010503>1</font><font color=#010203>1</font><font color=#020303>1</font><font color=#030103>0</font><font color=#030105>0</font><font color=#020101>1</font><font color=#010201>0</font><font color=#030302>1</font><font color=#010102>110</font><font color=#030305>0</font><font color=#070202>0</font><font color=#020405>0</font><font color=#060303>1</font><font color=#030305>0</font><font color=#070103>0</font><font color=#040205>0</font><font color=#040106>1</font><font color=#030204>10</font><font color=black>00</font><font color=#000002>1</font><font color=#020305>1</font><font color=#040402>0</font><font color=#070905>1</font><font color=#020a03>1</font><font color=#020803>1</font><font color=#010303>1</font><font color=#020103>0</font><font color=#020104>1</font><font color=#040202>1</font><font color=#020000>1</font><font color=black>10</font><font color=#000101>1</font><font color=#020102>0</font><font color=#010102>10001</font><font color=#020303>0</font><font color=#030203>1</font><font color=#040205>1</font><font color=#010101>1</font><font color=black>11001</font><font color=#010001>1</font><font color=#020203>0</font><font color=#030404>1</font><font color=#159b15>1</font><font color=#08f907>0</font><font color=#04fd02>0</font><font color=#04fd07>1</font><font color=#07fa09>1</font><font color=#15de16>1</font><font color=#061008>0</font><font color=#040405>0</font><font color=#145e16>1</font><font color=#09f90c>0</font><font color=#03fd05>1</font><font color=#03fd03>0</font><font color=#01fe03>0</font><font color=#0df20f>0</font><font color=#0d380c>1</font><font color=#060307>1</font><font color=#0a350b>0</font><font color=#10ef16>1</font><font color=#04fd05>1</font><font color=#03fe05>0</font><font color=#03fc04>1</font><font color=#0af908>0</font><font color=#136513>1</font><font color=#050104>1</font><font color=black>1000</font><br><font color=black>101</font><font color=#000001>0</font><font color=black>1010</font><font color=#000001>0</font><font color=black>1001111</font><font color=#000001>00</font><font color=black>01010</font><font color=#000002>0</font><font color=#010000>1</font><font color=black>0</font><font color=#010000>1</font><font color=black>101</font><font color=#010000>1</font><font color=black>1</font><font color=#000001>1</font><font color=black>1010010001001011</font><font color=#010000>0</font><font color=black>1</font><font color=#010000>1</font><font color=black>001</font><font color=#000001>0</font><font color=black>000011000000</font><font color=#000001>0</font><font color=black>10101110111110000110</font><font color=#000001>1</font><font color=#020002>0</font><font color=#030302>0</font><font color=#0c350e>1</font><font color=#14af17>1</font><font color=#0dea11>1</font><font color=#0af010>0</font><font color=#11d014>1</font><font color=#0f600f>0</font><font color=#030305>1</font><font color=#040205>0</font><font color=#091a0a>0</font><font color=#159c14>0</font><font color=#0de311>0</font><font color=#0af10f>1</font><font color=#12da14>1</font><font color=#138814>1</font><font color=#060b07>1</font><font color=#030404>0</font><font color=#040806>0</font><font color=#168018>0</font><font color=#0fdb15>1</font><font color=#0cf110>1</font><font color=#0fe111>1</font><font color=#159f18>1</font><font color=#081f09>1</font><font color=#030104>1</font><font color=black>1101</font><br><font color=black>01000011011101011101110101110111111100001001001101011101011111100010011111001101100101011</font><font color=#000001>1</font><font color=#010001>0</font><font color=#020001>1</font><font color=#020102>1</font><font color=#060e05>1</font><font color=#081e07>1</font><font color=#082306>1</font><font color=#051506>1</font><font color=#030507>0</font><font color=#010103>0</font><font color=#020204>1</font><font color=#020401>1</font><font color=#050a09>0</font><font color=#071d06>0</font><font color=#072406>0</font><font color=#061807>1</font><font color=#060708>0</font><font color=#020103>0</font><font color=#010103>0</font><font color=#010102>1</font><font color=#040805>0</font><font color=#071807>1</font><font color=#052605>0</font><font color=#061d04>1</font><font color=#070b06>1</font><font color=#010203>1</font><font color=#010000>0</font><font color=black>0100</font> | |
</pre></font> | |
<?php | |
if(isset($_POST['x'])) | |
{ | |
if(isset($_POST['NTLM'])) | |
{ | |
prForm($_POST['x']); | |
prOutForm(NTLMHash($_POST['x']), "NTLM"); | |
} | |
elseif(isset($_POST['base64_encode'])) | |
{ | |
prForm($_POST['x']); | |
prOutForm(base64_encode($_POST['x']), "base64_encode"); | |
} | |
elseif(isset($_POST['base64_decode'])) | |
{ | |
prForm($_POST['x']); | |
prOutForm(base64_decode($_POST['x']), "base64_decode"); | |
} | |
else | |
{ | |
$found = 0; | |
foreach(hash_algos() as $alg) | |
{ | |
if(isset($_POST[$alg])) | |
{ | |
prForm($_POST['x']); | |
prOutForm(hash($alg, $_POST['x']), $alg); | |
$found = 1; | |
} | |
} | |
if($found == 0) | |
{ | |
prForm($_POST['x']); | |
prOutForm("w0w u r l33t", "n00b"); | |
} | |
} | |
} | |
else | |
{ | |
prForm(""); | |
prOutForm('', 'null'); | |
} | |
function prForm($data) | |
{ | |
echo "<form action=\"hasher.php\" method=\"post\">" . "\n"; | |
echo "<textarea rows=\"10\" cols=\"80\" name=\"x\">$data</textarea><br><br>" . "\n"; | |
echo "<input type=\"submit\" name=\"NTLM\" value=\"NTLM\">" . "\n"; | |
echo "<input type=\"submit\" name=\"md2\" value=\"md2\">" . "\n"; | |
echo "<input type=\"submit\" name=\"md4\" value=\"md4\">" . "\n"; | |
echo "<input type=\"submit\" name=\"md5\" value=\"md5\">" . "\n"; | |
echo "<input type=\"submit\" name=\"sha1\" value=\"sha1\">" . "\n"; | |
echo "<input type=\"submit\" name=\"sha256\" value=\"sha256\">" . "\n"; | |
echo "<input type=\"submit\" name=\"sha384\" value=\"sha384\">" . "\n"; | |
echo "<input type=\"submit\" name=\"sha512\" value=\"sha512\">" . "\n"; | |
echo "<br>" . "\n"; | |
echo "<input type=\"submit\" name=\"base64_encode\" value=\"base64_encode\">" . "\n"; | |
echo "<input type=\"submit\" name=\"base64_decode\" value=\"base64_decode\">" . "\n"; | |
echo "<br>" . "\n"; | |
echo "<input type=\"submit\" name=\"ripemd128\" value=\"ripemd128\">" . "\n"; | |
echo "<input type=\"submit\" name=\"ripemd160\" value=\"ripemd160\">" . "\n"; | |
echo "<input type=\"submit\" name=\"ripemd256\" value=\"ripemd256\">" . "\n"; | |
echo "<input type=\"submit\" name=\"ripemd320\" value=\"ripemd320\">" . "\n"; | |
echo "<input type=\"submit\" name=\"whirlpool\" value=\"whirlpool\">" . "\n"; | |
echo "<br>" . "\n"; | |
echo "<input type=\"submit\" name=\"tiger128,3\" value=\"tiger128,3\">" . "\n"; | |
echo "<input type=\"submit\" name=\"tiger160,3\" value=\"tiger160,3\">" . "\n"; | |
echo "<input type=\"submit\" name=\"tiger192,3\" value=\"tiger192,3\">" . "\n"; | |
echo "<input type=\"submit\" name=\"tiger128,4\" value=\"tiger128,4\">" . "\n"; | |
echo "<input type=\"submit\" name=\"tiger160,4\" value=\"tiger160,4\">" . "\n"; | |
echo "<input type=\"submit\" name=\"tiger192,4\" value=\"tiger192,4\">" . "\n"; | |
echo "<br>" . "\n"; | |
echo "<input type=\"submit\" name=\"snefru\" value=\"snefru\">" . "\n"; | |
echo "<input type=\"submit\" name=\"adler32\" value=\"adler32\">" . "\n"; | |
echo "<input type=\"submit\" name=\"crc32\" value=\"crc32\">" . "\n"; | |
echo "<input type=\"submit\" name=\"crc32b\" value=\"crc32b\">" . "\n"; | |
echo "<br>" . "\n"; | |
echo "<input type=\"submit\" name=\"haval128,3\" value=\"haval128,3\">" . "\n"; | |
echo "<input type=\"submit\" name=\"haval160,3\" value=\"haval160,3\">" . "\n"; | |
echo "<input type=\"submit\" name=\"haval192,3\" value=\"haval192,3\">" . "\n"; | |
echo "<input type=\"submit\" name=\"haval224,3\" value=\"haval224,3\">" . "\n"; | |
echo "<input type=\"submit\" name=\"haval256,3\" value=\"haval256,3\">" . "\n"; | |
echo "<br>" . "\n"; | |
echo "<input type=\"submit\" name=\"haval128,4\" value=\"haval128,4\">" . "\n"; | |
echo "<input type=\"submit\" name=\"haval160,4\" value=\"haval160,4\">" . "\n"; | |
echo "<input type=\"submit\" name=\"haval192,4\" value=\"haval192,4\">" . "\n"; | |
echo "<input type=\"submit\" name=\"haval224,4\" value=\"haval224,4\">" . "\n"; | |
echo "<input type=\"submit\" name=\"haval256,4\" value=\"haval256,4\">" . "\n"; | |
echo "<br>" . "\n"; | |
echo "<input type=\"submit\" name=\"haval128,5\" value=\"haval128,5\">" . "\n"; | |
echo "<input type=\"submit\" name=\"haval160,5\" value=\"haval160,5\">" . "\n"; | |
echo "<input type=\"submit\" name=\"haval192,5\" value=\"haval192,5\">" . "\n"; | |
echo "<input type=\"submit\" name=\"haval224,5\" value=\"haval224,5\">" . "\n"; | |
echo "<input type=\"submit\" name=\"haval256,5\" value=\"haval256,5\">" . "\n"; | |
echo "</form>" . "\n"; | |
echo '<input type="submit" name="escapehtml" value="escape html" onclick="helper(6)">' . "\n"; | |
echo '<input type="submit" name="unescapehtml" value="unescape html" onclick="helper(7)">' . "\n"; | |
echo "<br>" . "\n"; | |
echo '<input type="submit" name="beautifyhtml" value="beautify html" onclick="helper(1)">' . "\n"; | |
echo '<input type="submit" name="beautifyjs" value="beautify js" onclick="helper(2)">' . "\n"; | |
echo "<br>" . "\n"; | |
echo '<input type="submit" name="unpackbkm" value="unpack bookmarklet" onclick="helper(3)">' . "\n"; | |
echo '<input type="submit" name="unpackjsob" value="unpack javascriptobfuscator.com" onclick="helper(4)">' . "\n"; | |
echo '<input type="submit" name="unpackpacker" value="unpack p.a.c.k.e.r" onclick="helper(5)"><br>' . "\n"; | |
echo "<input type=\"submit\" value=\"rot\" onclick=\"rotn_helper()\">"; | |
echo ' | |
<select id="rot"> | |
<option value="all">all</option> | |
<option value="1">1</option> | |
<option value="2">2</option> | |
<option value="3">3</option> | |
<option value="4">4</option> | |
<option value="5">5</option> | |
<option value="6">6</option> | |
<option value="7">7</option> | |
<option value="8">8</option> | |
<option value="9">9</option> | |
<option value="10">10</option> | |
<option value="11">11</option> | |
<option value="12">12</option> | |
<option value="13" selected="selected">13</option> | |
<option value="14">14</option> | |
<option value="15">15</option> | |
<option value="16">16</option> | |
<option value="17">17</option> | |
<option value="18">18</option> | |
<option value="19">19</option> | |
<option value="20">20</option> | |
<option value="21">21</option> | |
<option value="22">22</option> | |
<option value="23">23</option> | |
<option value="24">24</option> | |
<option value="25">25</option> | |
<option value="26">26</option> | |
<option value="27">27</option> | |
</select>'; | |
echo "<br><br>" . "\n"; | |
} | |
function prOutForm($data, $type) | |
{ | |
echo "<input type=\"submit\" name=\"flip\" value=\"flip\" onclick=\"flip()\">" . "\n"; | |
echo "<p class=\"def\">Hash type: $type</p>" . "\n"; | |
echo "<textarea rows=\"10\" cols=\"80\" name=\"y\">$data</textarea><br><br>" . "\n"; | |
} | |
/* NTLM hashing is not built into PHP */ | |
function NTLMHash($Input) | |
{ | |
// Convert the password from UTF8 to UTF16 (little endian) | |
$Input=iconv('UTF-8','UTF-16LE',$Input); | |
// Encrypt it with the MD4 hash | |
//$MD4Hash=bin2hex(mhash(MHASH_MD4,$Input)); | |
// You could use this instead, but mhash works on PHP 4 and 5 or above | |
// The hash function only works on 5 or above | |
$MD4Hash=hash('md4',$Input); | |
// Make it uppercase, not necessary, but it's common to do so with NTLM hashes | |
$NTLMHash=strtoupper($MD4Hash); | |
// Return the result | |
return($NTLMHash); | |
} | |
?> | |
<p class="def">(c) jiva</p> | |
</center> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment