filer/lib/crypto-js/rollups/hmac-sha224.js

19 lines
5.3 KiB
JavaScript

/*
CryptoJS v3.0.2
code.google.com/p/crypto-js
(c) 2009-2012 by Jeff Mott. All rights reserved.
code.google.com/p/crypto-js/wiki/License
*/
var CryptoJS=CryptoJS||function(h,j){var d={},f=d.lib={},k=f.Base=function(){function a(){}return{extend:function(n){a.prototype=this;var e=new a;n&&e.mixIn(n);e.$super=this;return e},create:function(){var a=this.extend();a.init.apply(a,arguments);return a},init:function(){},mixIn:function(a){for(var e in a)a.hasOwnProperty(e)&&(this[e]=a[e]);a.hasOwnProperty("toString")&&(this.toString=a.toString)},clone:function(){return this.$super.extend(this)}}}(),i=f.WordArray=k.extend({init:function(a,n){a=
this.words=a||[];this.sigBytes=n!=j?n:4*a.length},toString:function(a){return(a||l).stringify(this)},concat:function(a){var n=this.words,e=a.words,c=this.sigBytes,a=a.sigBytes;this.clamp();if(c%4)for(var b=0;b<a;b++)n[c+b>>>2]|=(e[b>>>2]>>>24-8*(b%4)&255)<<24-8*((c+b)%4);else if(65535<e.length)for(b=0;b<a;b+=4)n[c+b>>>2]=e[b>>>2];else n.push.apply(n,e);this.sigBytes+=a;return this},clamp:function(){var a=this.words,b=this.sigBytes;a[b>>>2]&=4294967295<<32-8*(b%4);a.length=h.ceil(b/4)},clone:function(){var a=
k.clone.call(this);a.words=this.words.slice(0);return a},random:function(a){for(var b=[],e=0;e<a;e+=4)b.push(4294967296*h.random()|0);return i.create(b,a)}}),o=d.enc={},l=o.Hex={stringify:function(a){for(var b=a.words,a=a.sigBytes,e=[],c=0;c<a;c++){var d=b[c>>>2]>>>24-8*(c%4)&255;e.push((d>>>4).toString(16));e.push((d&15).toString(16))}return e.join("")},parse:function(a){for(var b=a.length,e=[],c=0;c<b;c+=2)e[c>>>3]|=parseInt(a.substr(c,2),16)<<24-4*(c%8);return i.create(e,b/2)}},r=o.Latin1={stringify:function(a){for(var b=
a.words,a=a.sigBytes,e=[],c=0;c<a;c++)e.push(String.fromCharCode(b[c>>>2]>>>24-8*(c%4)&255));return e.join("")},parse:function(a){for(var b=a.length,e=[],c=0;c<b;c++)e[c>>>2]|=(a.charCodeAt(c)&255)<<24-8*(c%4);return i.create(e,b)}},s=o.Utf8={stringify:function(a){try{return decodeURIComponent(escape(r.stringify(a)))}catch(b){throw Error("Malformed UTF-8 data");}},parse:function(a){return r.parse(unescape(encodeURIComponent(a)))}},b=f.BufferedBlockAlgorithm=k.extend({reset:function(){this._data=i.create();
this._nDataBytes=0},_append:function(a){"string"==typeof a&&(a=s.parse(a));this._data.concat(a);this._nDataBytes+=a.sigBytes},_process:function(a){var b=this._data,e=b.words,c=b.sigBytes,d=this.blockSize,f=c/(4*d),f=a?h.ceil(f):h.max((f|0)-this._minBufferSize,0),a=f*d,c=h.min(4*a,c);if(a){for(var g=0;g<a;g+=d)this._doProcessBlock(e,g);g=e.splice(0,a);b.sigBytes-=c}return i.create(g,c)},clone:function(){var a=k.clone.call(this);a._data=this._data.clone();return a},_minBufferSize:0});f.Hasher=b.extend({init:function(){this.reset()},
reset:function(){b.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=b.clone.call(this);a._hash=this._hash.clone();return a},blockSize:16,_createHelper:function(a){return function(b,e){return a.create(e).finalize(b)}},_createHmacHelper:function(a){return function(b,e){return g.HMAC.create(a,e).finalize(b)}}});var g=d.algo={};return d}(Math);
(function(h){var j=CryptoJS,d=j.lib,f=d.WordArray,d=d.Hasher,k=j.algo,i=[],o=[];(function(){function d(a){for(var b=h.sqrt(a),e=2;e<=b;e++)if(!(a%e))return!1;return!0}function f(a){return 4294967296*(a-(a|0))|0}for(var b=2,g=0;64>g;)d(b)&&(8>g&&(i[g]=f(h.pow(b,0.5))),o[g]=f(h.pow(b,1/3)),g++),b++})();var l=[],k=k.SHA256=d.extend({_doReset:function(){this._hash=f.create(i.slice(0))},_doProcessBlock:function(d,f){for(var b=this._hash.words,g=b[0],a=b[1],h=b[2],e=b[3],c=b[4],k=b[5],i=b[6],j=b[7],m=0;64>
m;m++){if(16>m)l[m]=d[f+m]|0;else{var p=l[m-15],q=l[m-2];l[m]=((p<<25|p>>>7)^(p<<14|p>>>18)^p>>>3)+l[m-7]+((q<<15|q>>>17)^(q<<13|q>>>19)^q>>>10)+l[m-16]}p=j+((c<<26|c>>>6)^(c<<21|c>>>11)^(c<<7|c>>>25))+(c&k^~c&i)+o[m]+l[m];q=((g<<30|g>>>2)^(g<<19|g>>>13)^(g<<10|g>>>22))+(g&a^g&h^a&h);j=i;i=k;k=c;c=e+p|0;e=h;h=a;a=g;g=p+q|0}b[0]=b[0]+g|0;b[1]=b[1]+a|0;b[2]=b[2]+h|0;b[3]=b[3]+e|0;b[4]=b[4]+c|0;b[5]=b[5]+k|0;b[6]=b[6]+i|0;b[7]=b[7]+j|0},_doFinalize:function(){var d=this._data,f=d.words,b=8*this._nDataBytes,
g=8*d.sigBytes;f[g>>>5]|=128<<24-g%32;f[(g+64>>>9<<4)+15]=b;d.sigBytes=4*f.length;this._process()}});j.SHA256=d._createHelper(k);j.HmacSHA256=d._createHmacHelper(k)})(Math);
(function(){var h=CryptoJS,j=h.lib.WordArray,d=h.algo,f=d.SHA256,d=d.SHA224=f.extend({_doReset:function(){this._hash=j.create([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){f._doFinalize.call(this);this._hash.sigBytes-=4}});h.SHA224=f._createHelper(d);h.HmacSHA224=f._createHmacHelper(d)})();
(function(){var h=CryptoJS,j=h.enc.Utf8;h.algo.HMAC=h.lib.Base.extend({init:function(d,f){d=this._hasher=d.create();"string"==typeof f&&(f=j.parse(f));var h=d.blockSize,i=4*h;f.sigBytes>i&&(f=d.finalize(f));for(var o=this._oKey=f.clone(),l=this._iKey=f.clone(),r=o.words,s=l.words,b=0;b<h;b++)r[b]^=1549556828,s[b]^=909522486;o.sigBytes=l.sigBytes=i;this.reset()},reset:function(){var d=this._hasher;d.reset();d.update(this._iKey)},update:function(d){this._hasher.update(d);return this},finalize:function(d){var f=
this._hasher,d=f.finalize(d);f.reset();return f.finalize(this._oKey.clone().concat(d))}})})();