3 code.google.com/p/crypto-js
4 (c) 2009-2012 by Jeff Mott. All rights reserved.
5 code.google.com/p/crypto-js/wiki/License
7 var CryptoJS
=CryptoJS
||function(g
,i
){var f
={},b
=f
.lib
={},m
=b
.Base
=function(){function a(){}return{extend
:function(e
){a
.prototype=this;var c
=new a
;e
&&c
.mixIn(e
);c
.$super=this;return c
},create
:function(){var a
=this.extend();a
.init
.apply(a
,arguments
);return a
},init
:function(){},mixIn
:function(a
){for(var c
in a
)a
.hasOwnProperty(c
)&&(this[c]=a
[c]);a
.hasOwnProperty("toString")&&(this.toString
=a
.toString
)},clone
:function(){return this.$super.extend(this)}}}(),l
=b
.WordArray
=m
.extend({init
:function(a
,e
){a
=
8 this.words
=a
||[];this.sigBytes
=e
!=i
?e
:4*a
.length
},toString
:function(a
){return(a
||d
).stringify(this)},concat
:function(a
){var e
=this.words
,c
=a
.words
,o
=this.sigBytes
,a
=a
.sigBytes
;this.clamp();if(o
%4)for(var b
=0;b
<a
;b
++)e
[o
+b
>>>2]|=(c
[b
>>>2]>>>24-8*(b
%4)&255)<<24-8*((o
+b
)%4);else if(65535<c
.length
)for(b
=0;b
<a
;b
+=4)e
[o
+b
>>>2]=c
[b
>>>2];else e
.push
.apply(e
,c
);this.sigBytes
+=a
;return this},clamp
:function(){var a
=this.words
,e
=this.sigBytes
;a
[e
>>>2]&=4294967295<<32-8*(e
%4);a
.length
=g
.ceil(e
/4)},clone
:function(){var a
=
9 m
.clone
.call(this);a
.words
=this.words
.slice(0);return a
},random
:function(a
){for(var e
=[],c
=0;c
<a
;c
+=4)e
.push(4294967296*g
.random()|0);return l
.create(e
,a
)}}),n
=f
.enc
={},d
=n
.Hex
={stringify
:function(a
){for(var e
=a
.words
,a
=a
.sigBytes
,c
=[],b
=0;b
<a
;b
++){var d
=e
[b
>>>2]>>>24-8*(b
%4)&255;c
.push((d
>>>4).toString(16));c
.push((d
&15).toString(16))}return c
.join("")},parse
:function(a
){for(var e
=a
.length
,c
=[],b
=0;b
<e
;b
+=2)c
[b
>>>3]|=parseInt(a
.substr(b
,2),16)<<24-4*(b
%8);return l
.create(c
,e
/2)}},j
=n
.Latin1
={stringify
:function(a
){for(var e
=
10 a
.words
,a
=a
.sigBytes
,b
=[],d
=0;d
<a
;d
++)b
.push(String
.fromCharCode(e
[d
>>>2]>>>24-8*(d
%4)&255));return b
.join("")},parse
:function(a
){for(var b
=a
.length
,c
=[],d
=0;d
<b
;d
++)c
[d
>>>2]|=(a
.charCodeAt(d
)&255)<<24-8*(d
%4);return l
.create(c
,b
)}},k
=n
.Utf8
={stringify
:function(a
){try{return decodeURIComponent(escape(j
.stringify(a
)))}catch(b
){throw Error("Malformed UTF-8 data");}},parse
:function(a
){return j
.parse(unescape(encodeURIComponent(a
)))}},h
=b
.BufferedBlockAlgorithm
=m
.extend({reset
:function(){this._data
=l
.create();
11 this._nDataBytes
=0},_append
:function(a
){"string"==typeof a
&&(a
=k
.parse(a
));this._data
.concat(a
);this._nDataBytes
+=a
.sigBytes
},_process
:function(a
){var b
=this._data
,c
=b
.words
,d
=b
.sigBytes
,j
=this.blockSize
,h
=d
/(4*j
),h
=a
?g
.ceil(h
):g
.max((h
|0)-this._minBufferSize
,0),a
=h
*j
,d
=g
.min(4*a
,d
);if(a
){for(var f
=0;f
<a
;f
+=j
)this._doProcessBlock(c
,f
);f
=c
.splice(0,a
);b
.sigBytes
-=d
}return l
.create(f
,d
)},clone
:function(){var a
=m
.clone
.call(this);a
._data
=this._data
.clone();return a
},_minBufferSize
:0});b
.Hasher
=h
.extend({init
:function(){this.reset()},
12 reset
:function(){h
.reset
.call(this);this._doReset()},update
:function(a
){this._append(a
);this._process();return this},finalize
:function(a
){a
&&this._append(a
);this._doFinalize();return this._hash
},clone
:function(){var a
=h
.clone
.call(this);a
._hash
=this._hash
.clone();return a
},blockSize
:16,_createHelper
:function(a
){return function(b
,c
){return a
.create(c
).finalize(b
)}},_createHmacHelper
:function(a
){return function(b
,c
){return u
.HMAC
.create(a
,c
).finalize(b
)}}});var u
=f
.algo
={};return f
}(Math
);
13 (function(){var g
=CryptoJS
,i
=g
.lib
,f
=i
.WordArray
,i
=i
.Hasher
,b
=[],m
=g
.algo
.SHA1
=i
.extend({_doReset
:function(){this._hash
=f
.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock
:function(f
,n
){for(var d
=this._hash
.words
,j
=d
[0],k
=d
[1],h
=d
[2],g
=d
[3],a
=d
[4],e
=0;80>e
;e
++){if(16>e
)b
[e]=f
[n
+e
]|0;else{var c
=b
[e
-3]^b
[e
-8]^b
[e
-14]^b
[e
-16];b
[e]=c
<<1|c
>>>31}c
=(j
<<5|j
>>>27)+a
+b
[e];c
=20>e
?c
+((k
&h
|~k
&g
)+1518500249):40>e
?c
+((k
^h
^g
)+1859775393):60>e
?c
+((k
&h
|k
&g
|h
&g
)-1894007588):c
+((k
^h
^g
)-
14 899497514);a
=g
;g
=h
;h
=k
<<30|k
>>>2;k
=j
;j
=c
}d
[0]=d
[0]+j
|0;d
[1]=d
[1]+k
|0;d
[2]=d
[2]+h
|0;d
[3]=d
[3]+g
|0;d
[4]=d
[4]+a
|0},_doFinalize
:function(){var b
=this._data
,f
=b
.words
,d
=8*this._nDataBytes
,j
=8*b
.sigBytes
;f
[j
>>>5]|=128<<24-j
%32;f
[(j
+64>>>9<<4)+15]=d
;b
.sigBytes
=4*f
.length
;this._process()}});g
.SHA1
=i
._createHelper(m
);g
.HmacSHA1
=i
._createHmacHelper(m
)})();
15 (function(){var g
=CryptoJS
,i
=g
.enc
.Utf8
;g
.algo
.HMAC
=g
.lib
.Base
.extend({init
:function(f
,b
){f
=this._hasher
=f
.create();"string"==typeof b
&&(b
=i
.parse(b
));var g
=f
.blockSize
,l
=4*g
;b
.sigBytes
>l
&&(b
=f
.finalize(b
));for(var n
=this._oKey
=b
.clone(),d
=this._iKey
=b
.clone(),j
=n
.words
,k
=d
.words
,h
=0;h
<g
;h
++)j
[h]^=1549556828,k
[h]^=909522486;n
.sigBytes
=d
.sigBytes
=l
;this.reset()},reset
:function(){var f
=this._hasher
;f
.reset();f
.update(this._iKey
)},update
:function(f
){this._hasher
.update(f
);return this},finalize
:function(f
){var b
=
16 this._hasher
,f
=b
.finalize(f
);b
.reset();return b
.finalize(this._oKey
.clone().concat(f
))}})})();
17 (function(){var g
=CryptoJS
,i
=g
.lib
,f
=i
.Base
,b
=i
.WordArray
,i
=g
.algo
,m
=i
.HMAC
,l
=i
.PBKDF2
=f
.extend({cfg
:f
.extend({keySize
:4,hasher
:i
.SHA1
,iterations
:1}),init
:function(b
){this.cfg
=this.cfg
.extend(b
)},compute
:function(f
,d
){for(var g
=this.cfg
,k
=m
.create(g
.hasher
,f
),h
=b
.create(),i
=b
.create([1]),a
=h
.words
,e
=i
.words
,c
=g
.keySize
,g
=g
.iterations
;a
.length
<c
;){var l
=k
.update(d
).finalize(i
);k
.reset();for(var q
=l
.words
,t
=q
.length
,r
=l
,s
=1;s
<g
;s
++){r
=k
.finalize(r
);k
.reset();for(var v
=r
.words
,p
=0;p
<t
;p
++)q
[p]^=v
[p]}h
.concat(l
);
18 e
[0]++}h
.sigBytes
=4*c
;return h
}});g
.PBKDF2
=function(b
,d
,f
){return l
.create(f
).compute(b
,d
)}})();