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

17 lines
4.7 KiB
JavaScript
Raw Normal View History

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