js-sha3 0.11.0 → 0.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Change Log
2
2
 
3
+ ## v0.12.0 / 2026-07-18
4
+ ### Added
5
+ - KMACXOF128 and KMACXOF256 (NIST SP 800-185)
6
+
3
7
  ## v0.11.0 / 2026-07-18
4
8
  ### Added
5
9
  - TupleHash128, TupleHash256, TupleHashXOF128, and TupleHashXOF256 (NIST SP 800-185)
package/LICENSE.txt CHANGED
@@ -1,4 +1,4 @@
1
- Copyright 2015-2023 Chen, Yi-Cyuan
1
+ Copyright 2015-2026 Chen, Yi-Cyuan
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
package/README.md CHANGED
@@ -53,6 +53,8 @@ cshake128('Message to hash', 256, 'function name', 'customization');
53
53
  cshake256('Message to hash', 512, 'function name', 'customization');
54
54
  kmac128('key', 'Message to hash', 256, 'customization');
55
55
  kmac256('key', 'Message to hash', 512, 'customization');
56
+ kmacxof128('key', 'Message to hash', 256, 'customization');
57
+ kmacxof256('key', 'Message to hash', 512, 'customization');
56
58
  tuplehash128(['abc', 'd'], 256, 'customization');
57
59
  tuplehash256(['abc', 'd'], 512, 'customization');
58
60
  tuplehashxof128(['abc', 'd'], 256, 'customization');
@@ -129,6 +131,8 @@ const {
129
131
  cshake256,
130
132
  kmac128,
131
133
  kmac256,
134
+ kmacxof128,
135
+ kmacxof256,
132
136
  tuplehash128,
133
137
  tuplehash256,
134
138
  tuplehashxof128,
@@ -154,6 +158,8 @@ import {
154
158
  cshake256,
155
159
  kmac128,
156
160
  kmac256,
161
+ kmacxof128,
162
+ kmacxof256,
157
163
  tuplehash128,
158
164
  tuplehash256,
159
165
  tuplehashxof128,
package/build/sha3.min.js CHANGED
@@ -1,9 +1,9 @@
1
1
  /**
2
2
  * [js-sha3]{@link https://github.com/emn178/js-sha3}
3
3
  *
4
- * @version 0.11.0
4
+ * @version 0.12.0
5
5
  * @author Chen, Yi-Cyuan [emn178@gmail.com]
6
- * @copyright Chen, Yi-Cyuan 2015-2023
6
+ * @copyright Chen, Yi-Cyuan 2015-2026
7
7
  * @license MIT
8
8
  */
9
- !function(){"use strict";function t(t,e,r){this.blocks=[],this.s=[],this.padding=e,this.outputBits=r,this.reset=!0,this.finalized=!1,this.block=0,this.start=0,this.blockCount=1600-(t<<1)>>5,this.byteCount=this.blockCount<<2,this.outputBlocks=r>>5,this.extraBytes=(31&r)>>3;for(var n=0;n<50;++n)this.s[n]=0}function e(e,r,n){t.call(this,e,r,n)}function r(e,r,n,i){t.call(this,e,r,n),this.xof=!!i,this.inputActive=!1,this.inputBytesRemaining=0}var n="input is invalid type",i="finalize already called",o="tuple input is incomplete",u="object"==typeof window,a=u?window:{};a.JS_SHA3_NO_WINDOW&&(u=!1);var s=!u&&"object"==typeof self;!a.JS_SHA3_NO_NODE_JS&&"object"==typeof process&&process.versions&&process.versions.node?a=global:s&&(a=self);for(var h=!a.JS_SHA3_NO_COMMON_JS&&"object"==typeof module&&module.exports,f="function"==typeof define&&define.amd,c=!a.JS_SHA3_NO_ARRAY_BUFFER&&"undefined"!=typeof ArrayBuffer,p="0123456789abcdef".split(""),l=[4,1024,262144,67108864],d=[0,8,16,24],y=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],g=[224,256,384,512],v=[128,256],b=["hex","buffer","arrayBuffer","array","digest"],w={128:168,256:136},A=a.JS_SHA3_NO_NODE_JS||!Array.isArray?function(t){return"[object Array]"===Object.prototype.toString.call(t)}:Array.isArray,B=!c||!a.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView?ArrayBuffer.isView:function(t){return"object"==typeof t&&t.buffer&&t.buffer.constructor===ArrayBuffer},k=function(t){var e=typeof t;if("string"===e)return[t,!0];if("object"!==e||null===t)throw new Error(n);if(c&&t.constructor===ArrayBuffer)return[new Uint8Array(t),!1];if(!A(t)&&!B(t))throw new Error(n);return[t,!1]},_=function(t){return 0===k(t)[0].length},m=function(t){for(var e=[],r=0;r<t.length;++r)e[r]=t[r];return e},x=function(e,r,n){return function(i){return new t(e,r,e).update(i)[n]()}},S=function(e,r,n){return function(i,o){return new t(e,r,o).update(i)[n]()}},C=function(t,e,r){return function(e,n,i,o){return J["cshake"+t].update(e,n,i,o)[r]()}},z=function(t,e,r){return function(e,n,i,o){return J["kmac"+t].update(e,n,i,o)[r]()}},E=function(t,e,r,n){for(var i=0;i<b.length;++i){var o=b[i];t[o]=e(r,n,o)}return t},M=function(e,r){var n=x(e,r,"hex");return n.create=function(){return new t(e,r,e)},n.update=function(t){return n.create().update(t)},E(n,x,e,r)},O=function(t,e,r,n){return function(e,i,o){return J[(r?"tuplehashxof":"tuplehash")+t].update(e,i,o)[n]()}},R=function(t,e,i){var o=w[t],u=O(t,0,i,"hex");return u.create=function(n,u){return new r(t,e,n,i).bytepad(["TupleHash",u],o)},u.update=function(t,e,r){if(!A(t))throw new Error(n);for(var i=u.create(e,r),o=0;o<t.length;++o)i.update(t[o]);return i},E(u,function(t,e,r){return O(t,0,i,r)},t,e)},N=[{name:"keccak",padding:[1,256,65536,16777216],bits:g,createMethod:M},{name:"sha3",padding:[6,1536,393216,100663296],bits:g,createMethod:M},{name:"shake",padding:[31,7936,2031616,520093696],bits:v,createMethod:function(e,r){var n=S(e,r,"hex");return n.create=function(n){return new t(e,r,n)},n.update=function(t,e){return n.create(e).update(t)},E(n,S,e,r)}},{name:"cshake",padding:l,bits:v,createMethod:function(e,r){var n=w[e],i=C(e,0,"hex");return i.create=function(i,o,u){return _(o)&&_(u)?J["shake"+e].create(i):new t(e,r,i).bytepad([o,u],n)},i.update=function(t,e,r,n){return i.create(e,r,n).update(t)},E(i,C,e,r)}},{name:"kmac",padding:l,bits:v,createMethod:function(t,r){var n=w[t],i=z(t,0,"hex");return i.create=function(i,o,u){return new e(t,r,o).bytepad(["KMAC",u],n).bytepad([i],n)},i.update=function(t,e,r,n){return i.create(t,r,n).update(e)},E(i,z,t,r)}},{name:"tuplehash",padding:l,bits:v,createMethod:function(t,e){return R(t,e,!1)}},{name:"tuplehashxof",padding:l,bits:v,createMethod:function(t,e){return R(t,e,!0)}}],J={},j=[],I=0;I<N.length;++I)for(var H=N[I],F=H.bits,U=0;U<F.length;++U){var D=H.name+"_"+F[U];if(j.push(D),J[D]=H.createMethod(F[U],H.padding),"sha3"!==H.name){var L=H.name+F[U];j.push(L),J[L]=J[D]}}t.prototype.update=function(t){if(this.finalized)throw new Error(i);var e=k(t);t=e[0];for(var r,n,o=e[1],u=this.blocks,a=this.byteCount,s=t.length,h=this.blockCount,f=0,c=this.s;f<s;){if(this.reset)for(this.reset=!1,u[0]=this.block,r=1;r<h+1;++r)u[r]=0;if(o)for(r=this.start;f<s&&r<a;++f)(n=t.charCodeAt(f))<128?u[r>>2]|=n<<d[3&r++]:n<2048?(u[r>>2]|=(192|n>>6)<<d[3&r++],u[r>>2]|=(128|63&n)<<d[3&r++]):n<55296||n>=57344?(u[r>>2]|=(224|n>>12)<<d[3&r++],u[r>>2]|=(128|n>>6&63)<<d[3&r++],u[r>>2]|=(128|63&n)<<d[3&r++]):(n=65536+((1023&n)<<10|1023&t.charCodeAt(++f)),u[r>>2]|=(240|n>>18)<<d[3&r++],u[r>>2]|=(128|n>>12&63)<<d[3&r++],u[r>>2]|=(128|n>>6&63)<<d[3&r++],u[r>>2]|=(128|63&n)<<d[3&r++]);else for(r=this.start;f<s&&r<a;++f)u[r>>2]|=t[f]<<d[3&r++];if(this.lastByteIndex=r,r>=a){for(this.start=r-a,this.block=u[h],r=0;r<h;++r)c[r]^=u[r];V(c),this.reset=!0}else this.start=r}return this},t.prototype.encode=function(e,r){var n=255&e,i=1,o=[n];for(n=255&(e>>=8);n>0;)o.unshift(n),n=255&(e>>=8),++i;return r?o.push(i):o.unshift(i),t.prototype.update.call(this,o),o.length},t.prototype.encodeString=function(e){var r=k(e);e=r[0];var n=r[1],i=0,o=e.length;if(n)for(var u=0;u<e.length;++u){var a=e.charCodeAt(u);a<128?i+=1:a<2048?i+=2:a<55296||a>=57344?i+=3:(a=65536+((1023&a)<<10|1023&e.charCodeAt(++u)),i+=4)}else i=o;return i+=this.encode(8*i),t.prototype.update.call(this,e),i},t.prototype.bytepad=function(e,r){for(var n=this.encode(r),i=0;i<e.length;++i)n+=this.encodeString(e[i]);var o=(r-n%r)%r,u=[];return u.length=o,t.prototype.update.call(this,u),this},t.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var t=this.blocks,e=this.lastByteIndex,r=this.blockCount,n=this.s;if(t[e>>2]|=this.padding[3&e],this.lastByteIndex===this.byteCount)for(t[0]=t[r],e=1;e<r+1;++e)t[e]=0;for(t[r-1]|=2147483648,e=0;e<r;++e)n[e]^=t[e];V(n)}},t.prototype.toString=t.prototype.hex=function(){this.finalize();for(var t,e=this.blockCount,r=this.s,n=this.outputBlocks,i=this.extraBytes,o=0,u=0,a="";u<n;){for(o=0;o<e&&u<n;++o,++u)t=r[o],a+=p[t>>4&15]+p[15&t]+p[t>>12&15]+p[t>>8&15]+p[t>>20&15]+p[t>>16&15]+p[t>>28&15]+p[t>>24&15];u%e==0&&(r=m(r),V(r),o=0)}return i&&(t=r[o],a+=p[t>>4&15]+p[15&t],i>1&&(a+=p[t>>12&15]+p[t>>8&15]),i>2&&(a+=p[t>>20&15]+p[t>>16&15])),a},t.prototype.arrayBuffer=function(){this.finalize();var t,e=this.blockCount,r=this.s,n=this.outputBlocks,i=this.extraBytes,o=0,u=0,a=this.outputBits>>3;t=i?new ArrayBuffer(n+1<<2):new ArrayBuffer(a);for(var s=new Uint32Array(t);u<n;){for(o=0;o<e&&u<n;++o,++u)s[u]=r[o];u%e==0&&(r=m(r),V(r))}return i&&(s[u]=r[o],t=t.slice(0,a)),t},t.prototype.buffer=t.prototype.arrayBuffer,t.prototype.digest=t.prototype.array=function(){this.finalize();for(var t,e,r=this.blockCount,n=this.s,i=this.outputBlocks,o=this.extraBytes,u=0,a=0,s=[];a<i;){for(u=0;u<r&&a<i;++u,++a)t=a<<2,e=n[u],s[t]=255&e,s[t+1]=e>>8&255,s[t+2]=e>>16&255,s[t+3]=e>>24&255;a%r==0&&(n=m(n),V(n))}return o&&(t=a<<2,e=n[u],s[t]=255&e,o>1&&(s[t+1]=e>>8&255),o>2&&(s[t+2]=e>>16&255)),s},(e.prototype=new t).finalize=function(){return this.finalized||this.encode(this.outputBits,!0),t.prototype.finalize.call(this)},(r.prototype=new t).getMessageByteLength=function(t){var e=k(t);if(t=e[0],!e[1])return t.length;for(var r=0,n=0;n<t.length;++n){var i=t.charCodeAt(n);i<128?r+=1:i<2048?r+=2:i<55296||i>=57344?r+=3:(++n,r+=4)}return r},r.prototype.beginInput=function(t){if(this.finalized)throw new Error(i);if(this.inputActive)throw new Error(o);if("number"!=typeof t||!isFinite(t)||t<0||Math.floor(t)!==t||t>268435455)throw new Error("tuple input byte length is invalid");return this.encode(8*t,!1),0===t?(this.inputActive=!1,this.inputBytesRemaining=0):(this.inputActive=!0,this.inputBytesRemaining=t),this},r.prototype.updateChunk=function(e){if(this.finalized)throw new Error(i);if(!this.inputActive)throw new Error("no active tuple input");var r=this.getMessageByteLength(e);if(r>this.inputBytesRemaining)throw new Error("tuple input exceeds declared length");return t.prototype.update.call(this,e),this.inputBytesRemaining-=r,0===this.inputBytesRemaining&&(this.inputActive=!1),this},r.prototype.update=function(t){if(this.finalized)throw new Error(i);if(this.inputActive)throw new Error(o);var e=this.getMessageByteLength(t);return this.beginInput(e),0===e?this:this.updateChunk(t)},r.prototype.finalize=function(){if(this.inputActive)throw new Error(o);return this.finalized||this.encode(this.xof?0:this.outputBits,!0),t.prototype.finalize.call(this)};var V=function(t){var e,r,n,i,o,u,a,s,h,f,c,p,l,d,g,v,b,w,A,B,k,_,m,x,S,C,z,E,M,O,R,N,J,j,I,H,F,U,D,L,V,W,Y,K,T,q,G,P,Q,X,Z,$,tt,et,rt,nt,it,ot,ut,at,st,ht,ft;for(n=0;n<48;n+=2)i=t[0]^t[10]^t[20]^t[30]^t[40],o=t[1]^t[11]^t[21]^t[31]^t[41],u=t[2]^t[12]^t[22]^t[32]^t[42],a=t[3]^t[13]^t[23]^t[33]^t[43],s=t[4]^t[14]^t[24]^t[34]^t[44],h=t[5]^t[15]^t[25]^t[35]^t[45],f=t[6]^t[16]^t[26]^t[36]^t[46],c=t[7]^t[17]^t[27]^t[37]^t[47],e=(p=t[8]^t[18]^t[28]^t[38]^t[48])^(u<<1|a>>>31),r=(l=t[9]^t[19]^t[29]^t[39]^t[49])^(a<<1|u>>>31),t[0]^=e,t[1]^=r,t[10]^=e,t[11]^=r,t[20]^=e,t[21]^=r,t[30]^=e,t[31]^=r,t[40]^=e,t[41]^=r,e=i^(s<<1|h>>>31),r=o^(h<<1|s>>>31),t[2]^=e,t[3]^=r,t[12]^=e,t[13]^=r,t[22]^=e,t[23]^=r,t[32]^=e,t[33]^=r,t[42]^=e,t[43]^=r,e=u^(f<<1|c>>>31),r=a^(c<<1|f>>>31),t[4]^=e,t[5]^=r,t[14]^=e,t[15]^=r,t[24]^=e,t[25]^=r,t[34]^=e,t[35]^=r,t[44]^=e,t[45]^=r,e=s^(p<<1|l>>>31),r=h^(l<<1|p>>>31),t[6]^=e,t[7]^=r,t[16]^=e,t[17]^=r,t[26]^=e,t[27]^=r,t[36]^=e,t[37]^=r,t[46]^=e,t[47]^=r,e=f^(i<<1|o>>>31),r=c^(o<<1|i>>>31),t[8]^=e,t[9]^=r,t[18]^=e,t[19]^=r,t[28]^=e,t[29]^=r,t[38]^=e,t[39]^=r,t[48]^=e,t[49]^=r,d=t[0],g=t[1],q=t[11]<<4|t[10]>>>28,G=t[10]<<4|t[11]>>>28,E=t[20]<<3|t[21]>>>29,M=t[21]<<3|t[20]>>>29,at=t[31]<<9|t[30]>>>23,st=t[30]<<9|t[31]>>>23,W=t[40]<<18|t[41]>>>14,Y=t[41]<<18|t[40]>>>14,j=t[2]<<1|t[3]>>>31,I=t[3]<<1|t[2]>>>31,v=t[13]<<12|t[12]>>>20,b=t[12]<<12|t[13]>>>20,P=t[22]<<10|t[23]>>>22,Q=t[23]<<10|t[22]>>>22,O=t[33]<<13|t[32]>>>19,R=t[32]<<13|t[33]>>>19,ht=t[42]<<2|t[43]>>>30,ft=t[43]<<2|t[42]>>>30,et=t[5]<<30|t[4]>>>2,rt=t[4]<<30|t[5]>>>2,H=t[14]<<6|t[15]>>>26,F=t[15]<<6|t[14]>>>26,w=t[25]<<11|t[24]>>>21,A=t[24]<<11|t[25]>>>21,X=t[34]<<15|t[35]>>>17,Z=t[35]<<15|t[34]>>>17,N=t[45]<<29|t[44]>>>3,J=t[44]<<29|t[45]>>>3,x=t[6]<<28|t[7]>>>4,S=t[7]<<28|t[6]>>>4,nt=t[17]<<23|t[16]>>>9,it=t[16]<<23|t[17]>>>9,U=t[26]<<25|t[27]>>>7,D=t[27]<<25|t[26]>>>7,B=t[36]<<21|t[37]>>>11,k=t[37]<<21|t[36]>>>11,$=t[47]<<24|t[46]>>>8,tt=t[46]<<24|t[47]>>>8,K=t[8]<<27|t[9]>>>5,T=t[9]<<27|t[8]>>>5,C=t[18]<<20|t[19]>>>12,z=t[19]<<20|t[18]>>>12,ot=t[29]<<7|t[28]>>>25,ut=t[28]<<7|t[29]>>>25,L=t[38]<<8|t[39]>>>24,V=t[39]<<8|t[38]>>>24,_=t[48]<<14|t[49]>>>18,m=t[49]<<14|t[48]>>>18,t[0]=d^~v&w,t[1]=g^~b&A,t[10]=x^~C&E,t[11]=S^~z&M,t[20]=j^~H&U,t[21]=I^~F&D,t[30]=K^~q&P,t[31]=T^~G&Q,t[40]=et^~nt&ot,t[41]=rt^~it&ut,t[2]=v^~w&B,t[3]=b^~A&k,t[12]=C^~E&O,t[13]=z^~M&R,t[22]=H^~U&L,t[23]=F^~D&V,t[32]=q^~P&X,t[33]=G^~Q&Z,t[42]=nt^~ot&at,t[43]=it^~ut&st,t[4]=w^~B&_,t[5]=A^~k&m,t[14]=E^~O&N,t[15]=M^~R&J,t[24]=U^~L&W,t[25]=D^~V&Y,t[34]=P^~X&$,t[35]=Q^~Z&tt,t[44]=ot^~at&ht,t[45]=ut^~st&ft,t[6]=B^~_&d,t[7]=k^~m&g,t[16]=O^~N&x,t[17]=R^~J&S,t[26]=L^~W&j,t[27]=V^~Y&I,t[36]=X^~$&K,t[37]=Z^~tt&T,t[46]=at^~ht&et,t[47]=st^~ft&rt,t[8]=_^~d&v,t[9]=m^~g&b,t[18]=N^~x&C,t[19]=J^~S&z,t[28]=W^~j&H,t[29]=Y^~I&F,t[38]=$^~K&q,t[39]=tt^~T&G,t[48]=ht^~et&nt,t[49]=ft^~rt&it,t[0]^=y[n],t[1]^=y[n+1]};if(h)module.exports=J;else{for(I=0;I<j.length;++I)a[j[I]]=J[j[I]];f&&define(function(){return J})}}();
9
+ !function(){"use strict";function t(t,e,r){this.blocks=[],this.s=[],this.padding=e,this.outputBits=r,this.reset=!0,this.finalized=!1,this.block=0,this.start=0,this.blockCount=1600-(t<<1)>>5,this.byteCount=this.blockCount<<2,this.outputBlocks=r>>5,this.extraBytes=(31&r)>>3;for(var n=0;n<50;++n)this.s[n]=0}function e(e,r,n,i){t.call(this,e,r,n),this.xof=i}function r(t,r,n,i){e.call(this,t,r,n,i),this.inputActive=!1,this.inputBytesRemaining=0}var n="input is invalid type",i="tuple input is incomplete",o="object"==typeof window,u=o?window:{};u.JS_SHA3_NO_WINDOW&&(o=!1);var a=!o&&"object"==typeof self;!u.JS_SHA3_NO_NODE_JS&&"object"==typeof process&&process.versions&&process.versions.node?u=global:a&&(u=self);for(var s=!u.JS_SHA3_NO_COMMON_JS&&"object"==typeof module&&module.exports,f="function"==typeof define&&define.amd,h=!u.JS_SHA3_NO_ARRAY_BUFFER&&"undefined"!=typeof ArrayBuffer,c="0123456789abcdef".split(""),p=[4,1024,262144,67108864],d=[0,8,16,24],l=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],y=[224,256,384,512],g=[128,256],v=["hex","buffer","arrayBuffer","array","digest"],b={128:168,256:136},w=u.JS_SHA3_NO_NODE_JS||!Array.isArray?function(t){return"[object Array]"===Object.prototype.toString.call(t)}:Array.isArray,A=!h||!u.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView?ArrayBuffer.isView:function(t){return"object"==typeof t&&t.buffer&&t.buffer.constructor===ArrayBuffer},B=function(t){var e=typeof t;if("string"===e)return[t,!0];if("object"!==e||null===t)throw new Error(n);if(h&&t.constructor===ArrayBuffer)return[new Uint8Array(t),!1];if(!w(t)&&!A(t))throw new Error(n);return[t,!1]},k=function(t){return 0===B(t)[0].length},_=function(t){for(var e=[],r=0;r<t.length;++r)e[r]=t[r];return e},m=function(e,r,n){return function(i){return new t(e,r,e).update(i)[n]()}},x=function(e,r,n){return function(i,o){return new t(e,r,o).update(i)[n]()}},C=function(t,e,r){return function(e,n,i,o){return J["cshake"+t].update(e,n,i,o)[r]()}},S=function(t,e,r,n){return function(e,i,o,u){return J[(r?"kmacxof":"kmac")+t].update(e,i,o,u)[n]()}},M=function(t,e,r,n){return function(e,i,o){return J[(r?"tuplehashxof":"tuplehash")+t].update(e,i,o)[n]()}},z=function(t,e,r,n){for(var i=0;i<v.length;++i){var o=v[i];t[o]=e(r,n,o)}return t},E=function(e,r){var n=m(e,r,"hex");return n.create=function(){return new t(e,r,e)},n.update=function(t){return n.create().update(t)},z(n,m,e,r)},O=function(t,r,n){var i=b[t],o=S(t,0,n,"hex");return o.create=function(o,u,a){return new e(t,r,u,n).bytepad(["KMAC",a],i).bytepad([o],i)},o.update=function(t,e,r,n){return o.create(t,r,n).update(e)},z(o,function(t,e,r){return S(t,0,n,r)},t,r)},R=function(t,e,i){var o=b[t],u=M(t,0,i,"hex");return u.create=function(n,u){return new r(t,e,n,i).bytepad(["TupleHash",u],o)},u.update=function(t,e,r){if(!w(t))throw new Error(n);for(var i=u.create(e,r),o=0;o<t.length;++o)i.update(t[o]);return i},z(u,function(t,e,r){return M(t,0,i,r)},t,e)},N=[{name:"keccak",padding:[1,256,65536,16777216],bits:y,createMethod:E},{name:"sha3",padding:[6,1536,393216,100663296],bits:y,createMethod:E},{name:"shake",padding:[31,7936,2031616,520093696],bits:g,createMethod:function(e,r){var n=x(e,r,"hex");return n.create=function(n){return new t(e,r,n)},n.update=function(t,e){return n.create(e).update(t)},z(n,x,e,r)}},{name:"cshake",padding:p,bits:g,createMethod:function(e,r){var n=b[e],i=C(e,0,"hex");return i.create=function(i,o,u){return k(o)&&k(u)?J["shake"+e].create(i):new t(e,r,i).bytepad([o,u],n)},i.update=function(t,e,r,n){return i.create(e,r,n).update(t)},z(i,C,e,r)}},{name:"kmac",padding:p,bits:g,createMethod:function(t,e){return O(t,e,!1)}},{name:"kmacxof",padding:p,bits:g,createMethod:function(t,e){return O(t,e,!0)}},{name:"tuplehash",padding:p,bits:g,createMethod:function(t,e){return R(t,e,!1)}},{name:"tuplehashxof",padding:p,bits:g,createMethod:function(t,e){return R(t,e,!0)}}],J={},j=[],I=0;I<N.length;++I)for(var H=N[I],F=H.bits,U=0;U<F.length;++U){var D=H.name+"_"+F[U];if(j.push(D),J[D]=H.createMethod(F[U],H.padding),"sha3"!==H.name){var L=H.name+F[U];j.push(L),J[L]=J[D]}}t.prototype.update=function(t){if(this.finalized)throw new Error("finalize already called");var e=B(t);t=e[0];for(var r,n,i=e[1],o=this.blocks,u=this.byteCount,a=t.length,s=this.blockCount,f=0,h=this.s;f<a;){if(this.reset)for(this.reset=!1,o[0]=this.block,r=1;r<s+1;++r)o[r]=0;if(i)for(r=this.start;f<a&&r<u;++f)(n=t.charCodeAt(f))<128?o[r>>2]|=n<<d[3&r++]:n<2048?(o[r>>2]|=(192|n>>6)<<d[3&r++],o[r>>2]|=(128|63&n)<<d[3&r++]):n<55296||n>=57344?(o[r>>2]|=(224|n>>12)<<d[3&r++],o[r>>2]|=(128|n>>6&63)<<d[3&r++],o[r>>2]|=(128|63&n)<<d[3&r++]):(n=65536+((1023&n)<<10|1023&t.charCodeAt(++f)),o[r>>2]|=(240|n>>18)<<d[3&r++],o[r>>2]|=(128|n>>12&63)<<d[3&r++],o[r>>2]|=(128|n>>6&63)<<d[3&r++],o[r>>2]|=(128|63&n)<<d[3&r++]);else for(r=this.start;f<a&&r<u;++f)o[r>>2]|=t[f]<<d[3&r++];if(this.lastByteIndex=r,r>=u){for(this.start=r-u,this.block=o[s],r=0;r<s;++r)h[r]^=o[r];V(h),this.reset=!0}else this.start=r}return this},t.prototype.encode=function(e,r){var n=255&e,i=1,o=[n];for(n=255&(e>>=8);n>0;)o.unshift(n),n=255&(e>>=8),++i;return r?o.push(i):o.unshift(i),t.prototype.update.call(this,o),o.length},t.prototype.encodeString=function(e){var r=B(e);e=r[0];var n=r[1],i=0,o=e.length;if(n)for(var u=0;u<e.length;++u){var a=e.charCodeAt(u);a<128?i+=1:a<2048?i+=2:a<55296||a>=57344?i+=3:(a=65536+((1023&a)<<10|1023&e.charCodeAt(++u)),i+=4)}else i=o;return i+=this.encode(8*i),t.prototype.update.call(this,e),i},t.prototype.bytepad=function(e,r){for(var n=this.encode(r),i=0;i<e.length;++i)n+=this.encodeString(e[i]);var o=(r-n%r)%r,u=[];return u.length=o,t.prototype.update.call(this,u),this},t.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var t=this.blocks,e=this.lastByteIndex,r=this.blockCount,n=this.s;if(t[e>>2]|=this.padding[3&e],this.lastByteIndex===this.byteCount)for(t[0]=t[r],e=1;e<r+1;++e)t[e]=0;for(t[r-1]|=2147483648,e=0;e<r;++e)n[e]^=t[e];V(n)}},t.prototype.toString=t.prototype.hex=function(){this.finalize();for(var t,e=this.blockCount,r=this.s,n=this.outputBlocks,i=this.extraBytes,o=0,u=0,a="";u<n;){for(o=0;o<e&&u<n;++o,++u)t=r[o],a+=c[t>>4&15]+c[15&t]+c[t>>12&15]+c[t>>8&15]+c[t>>20&15]+c[t>>16&15]+c[t>>28&15]+c[t>>24&15];u%e==0&&(r=_(r),V(r),o=0)}return i&&(t=r[o],a+=c[t>>4&15]+c[15&t],i>1&&(a+=c[t>>12&15]+c[t>>8&15]),i>2&&(a+=c[t>>20&15]+c[t>>16&15])),a},t.prototype.arrayBuffer=function(){this.finalize();var t,e=this.blockCount,r=this.s,n=this.outputBlocks,i=this.extraBytes,o=0,u=0,a=this.outputBits>>3;t=i?new ArrayBuffer(n+1<<2):new ArrayBuffer(a);for(var s=new Uint32Array(t);u<n;){for(o=0;o<e&&u<n;++o,++u)s[u]=r[o];u%e==0&&(r=_(r),V(r))}return i&&(s[u]=r[o],t=t.slice(0,a)),t},t.prototype.buffer=t.prototype.arrayBuffer,t.prototype.digest=t.prototype.array=function(){this.finalize();for(var t,e,r=this.blockCount,n=this.s,i=this.outputBlocks,o=this.extraBytes,u=0,a=0,s=[];a<i;){for(u=0;u<r&&a<i;++u,++a)t=a<<2,e=n[u],s[t]=255&e,s[t+1]=e>>8&255,s[t+2]=e>>16&255,s[t+3]=e>>24&255;a%r==0&&(n=_(n),V(n))}return o&&(t=a<<2,e=n[u],s[t]=255&e,o>1&&(s[t+1]=e>>8&255),o>2&&(s[t+2]=e>>16&255)),s},(e.prototype=new t).finalize=function(){return this.finalized||this.encode(this.xof?0:this.outputBits,!0),t.prototype.finalize.call(this)},(r.prototype=new e).getMessageByteLength=function(t){var e=B(t);if(t=e[0],!e[1])return t.length;for(var r=0,n=0;n<t.length;++n){var i=t.charCodeAt(n);i<128?r+=1:i<2048?r+=2:i<55296||i>=57344?r+=3:(++n,r+=4)}return r},r.prototype.beginInput=function(t){if(this.inputActive)throw new Error(i);if("number"!=typeof t||!isFinite(t)||t<0||Math.floor(t)!==t||t>268435455)throw new Error("tuple input byte length is invalid");return this.encode(8*t,!1),0!==t&&(this.inputActive=!0,this.inputBytesRemaining=t),this},r.prototype._updateChunk=function(t,r){return e.prototype.update.call(this,t),this.inputBytesRemaining-=r,0===this.inputBytesRemaining&&(this.inputActive=!1),this},r.prototype.updateChunk=function(t){if(!this.inputActive)throw new Error("no active tuple input");var e=this.getMessageByteLength(t);if(e>this.inputBytesRemaining)throw new Error("tuple input exceeds declared length");return this._updateChunk(t,e)},r.prototype.update=function(t){var e=this.getMessageByteLength(t);return this.beginInput(e),this._updateChunk(t,e)},r.prototype.finalize=function(){if(this.inputActive)throw new Error(i);return e.prototype.finalize.call(this)};var V=function(t){var e,r,n,i,o,u,a,s,f,h,c,p,d,y,g,v,b,w,A,B,k,_,m,x,C,S,M,z,E,O,R,N,J,j,I,H,F,U,D,L,V,W,Y,K,T,q,G,P,Q,X,Z,$,tt,et,rt,nt,it,ot,ut,at,st,ft,ht;for(n=0;n<48;n+=2)i=t[0]^t[10]^t[20]^t[30]^t[40],o=t[1]^t[11]^t[21]^t[31]^t[41],u=t[2]^t[12]^t[22]^t[32]^t[42],a=t[3]^t[13]^t[23]^t[33]^t[43],s=t[4]^t[14]^t[24]^t[34]^t[44],f=t[5]^t[15]^t[25]^t[35]^t[45],h=t[6]^t[16]^t[26]^t[36]^t[46],c=t[7]^t[17]^t[27]^t[37]^t[47],e=(p=t[8]^t[18]^t[28]^t[38]^t[48])^(u<<1|a>>>31),r=(d=t[9]^t[19]^t[29]^t[39]^t[49])^(a<<1|u>>>31),t[0]^=e,t[1]^=r,t[10]^=e,t[11]^=r,t[20]^=e,t[21]^=r,t[30]^=e,t[31]^=r,t[40]^=e,t[41]^=r,e=i^(s<<1|f>>>31),r=o^(f<<1|s>>>31),t[2]^=e,t[3]^=r,t[12]^=e,t[13]^=r,t[22]^=e,t[23]^=r,t[32]^=e,t[33]^=r,t[42]^=e,t[43]^=r,e=u^(h<<1|c>>>31),r=a^(c<<1|h>>>31),t[4]^=e,t[5]^=r,t[14]^=e,t[15]^=r,t[24]^=e,t[25]^=r,t[34]^=e,t[35]^=r,t[44]^=e,t[45]^=r,e=s^(p<<1|d>>>31),r=f^(d<<1|p>>>31),t[6]^=e,t[7]^=r,t[16]^=e,t[17]^=r,t[26]^=e,t[27]^=r,t[36]^=e,t[37]^=r,t[46]^=e,t[47]^=r,e=h^(i<<1|o>>>31),r=c^(o<<1|i>>>31),t[8]^=e,t[9]^=r,t[18]^=e,t[19]^=r,t[28]^=e,t[29]^=r,t[38]^=e,t[39]^=r,t[48]^=e,t[49]^=r,y=t[0],g=t[1],q=t[11]<<4|t[10]>>>28,G=t[10]<<4|t[11]>>>28,z=t[20]<<3|t[21]>>>29,E=t[21]<<3|t[20]>>>29,at=t[31]<<9|t[30]>>>23,st=t[30]<<9|t[31]>>>23,W=t[40]<<18|t[41]>>>14,Y=t[41]<<18|t[40]>>>14,j=t[2]<<1|t[3]>>>31,I=t[3]<<1|t[2]>>>31,v=t[13]<<12|t[12]>>>20,b=t[12]<<12|t[13]>>>20,P=t[22]<<10|t[23]>>>22,Q=t[23]<<10|t[22]>>>22,O=t[33]<<13|t[32]>>>19,R=t[32]<<13|t[33]>>>19,ft=t[42]<<2|t[43]>>>30,ht=t[43]<<2|t[42]>>>30,et=t[5]<<30|t[4]>>>2,rt=t[4]<<30|t[5]>>>2,H=t[14]<<6|t[15]>>>26,F=t[15]<<6|t[14]>>>26,w=t[25]<<11|t[24]>>>21,A=t[24]<<11|t[25]>>>21,X=t[34]<<15|t[35]>>>17,Z=t[35]<<15|t[34]>>>17,N=t[45]<<29|t[44]>>>3,J=t[44]<<29|t[45]>>>3,x=t[6]<<28|t[7]>>>4,C=t[7]<<28|t[6]>>>4,nt=t[17]<<23|t[16]>>>9,it=t[16]<<23|t[17]>>>9,U=t[26]<<25|t[27]>>>7,D=t[27]<<25|t[26]>>>7,B=t[36]<<21|t[37]>>>11,k=t[37]<<21|t[36]>>>11,$=t[47]<<24|t[46]>>>8,tt=t[46]<<24|t[47]>>>8,K=t[8]<<27|t[9]>>>5,T=t[9]<<27|t[8]>>>5,S=t[18]<<20|t[19]>>>12,M=t[19]<<20|t[18]>>>12,ot=t[29]<<7|t[28]>>>25,ut=t[28]<<7|t[29]>>>25,L=t[38]<<8|t[39]>>>24,V=t[39]<<8|t[38]>>>24,_=t[48]<<14|t[49]>>>18,m=t[49]<<14|t[48]>>>18,t[0]=y^~v&w,t[1]=g^~b&A,t[10]=x^~S&z,t[11]=C^~M&E,t[20]=j^~H&U,t[21]=I^~F&D,t[30]=K^~q&P,t[31]=T^~G&Q,t[40]=et^~nt&ot,t[41]=rt^~it&ut,t[2]=v^~w&B,t[3]=b^~A&k,t[12]=S^~z&O,t[13]=M^~E&R,t[22]=H^~U&L,t[23]=F^~D&V,t[32]=q^~P&X,t[33]=G^~Q&Z,t[42]=nt^~ot&at,t[43]=it^~ut&st,t[4]=w^~B&_,t[5]=A^~k&m,t[14]=z^~O&N,t[15]=E^~R&J,t[24]=U^~L&W,t[25]=D^~V&Y,t[34]=P^~X&$,t[35]=Q^~Z&tt,t[44]=ot^~at&ft,t[45]=ut^~st&ht,t[6]=B^~_&y,t[7]=k^~m&g,t[16]=O^~N&x,t[17]=R^~J&C,t[26]=L^~W&j,t[27]=V^~Y&I,t[36]=X^~$&K,t[37]=Z^~tt&T,t[46]=at^~ft&et,t[47]=st^~ht&rt,t[8]=_^~y&v,t[9]=m^~g&b,t[18]=N^~x&S,t[19]=J^~C&M,t[28]=W^~j&H,t[29]=Y^~I&F,t[38]=$^~K&q,t[39]=tt^~T&G,t[48]=ft^~et&nt,t[49]=ht^~rt&it,t[0]^=l[n],t[1]^=l[n+1]};if(s)module.exports=J;else{for(I=0;I<j.length;++I)u[j[I]]=J[j[I]];f&&define(function(){return J})}}();
@@ -2,8 +2,8 @@ var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?windo
2
2
  /**
3
3
  * [js-sha3]{@link https://github.com/emn178/js-sha3}
4
4
  *
5
- * @version 0.11.0
5
+ * @version 0.12.0
6
6
  * @author Chen, Yi-Cyuan [emn178@gmail.com]
7
- * @copyright Chen, Yi-Cyuan 2015-2023
7
+ * @copyright Chen, Yi-Cyuan 2015-2026
8
8
  * @license MIT
9
- */r=n,function(){var e="input is invalid type",n="finalize already called",i="tuple input is incomplete",o="object"==typeof window,a=o?window:{};a.JS_SHA3_NO_WINDOW&&(o=!1);var s=!o&&"object"==typeof self;!a.JS_SHA3_NO_NODE_JS&&"object"==typeof process&&process.versions&&process.versions.node?a=t:s&&(a=self);for(var u=!a.JS_SHA3_NO_COMMON_JS&&r.exports,h=!a.JS_SHA3_NO_ARRAY_BUFFER&&"undefined"!=typeof ArrayBuffer,f="0123456789abcdef".split(""),c=[4,1024,262144,67108864],p=[0,8,16,24],l=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],d=[224,256,384,512],y=[128,256],g=["hex","buffer","arrayBuffer","array","digest"],k={128:168,256:136},v=a.JS_SHA3_NO_NODE_JS||!Array.isArray?function(t){return"[object Array]"===Object.prototype.toString.call(t)}:Array.isArray,b=!h||!a.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView?ArrayBuffer.isView:function(t){return"object"==typeof t&&t.buffer&&t.buffer.constructor===ArrayBuffer},w=function(t){var r=typeof t;if("string"===r)return[t,!0];if("object"!==r||null===t)throw new Error(e);if(h&&t.constructor===ArrayBuffer)return[new Uint8Array(t),!1];if(!v(t)&&!b(t))throw new Error(e);return[t,!1]},_=function(t){return 0===w(t)[0].length},A=function(t){for(var e=[],r=0;r<t.length;++r)e[r]=t[r];return e},B=function(t,e,r){return function(n){return new D(t,e,t).update(n)[r]()}},x=function(t,e,r){return function(n,i){return new D(t,e,i).update(n)[r]()}},m=function(t,e,r){return function(e,n,i,o){return R["cshake"+t].update(e,n,i,o)[r]()}},S=function(t,e,r){return function(e,n,i,o){return R["kmac"+t].update(e,n,i,o)[r]()}},C=function(t,e,r,n){for(var i=0;i<g.length;++i){var o=g[i];t[o]=e(r,n,o)}return t},z=function(t,e){var r=B(t,e,"hex");return r.create=function(){return new D(t,e,t)},r.update=function(t){return r.create().update(t)},C(r,B,t,e)},E=function(t,e,r,n){return function(e,i,o){return R[(r?"tuplehashxof":"tuplehash")+t].update(e,i,o)[n]()}},M=function(t,r,n){var i=k[t],o=E(t,0,n,"hex");return o.create=function(e,o){return new T(t,r,e,n).bytepad(["TupleHash",o],i)},o.update=function(t,r,n){if(!v(t))throw new Error(e);for(var i=o.create(r,n),a=0;a<t.length;++a)i.update(t[a]);return i},C(o,function(t,e,r){return E(t,0,n,r)},t,r)},O=[{name:"keccak",padding:[1,256,65536,16777216],bits:d,createMethod:z},{name:"sha3",padding:[6,1536,393216,100663296],bits:d,createMethod:z},{name:"shake",padding:[31,7936,2031616,520093696],bits:y,createMethod:function(t,e){var r=x(t,e,"hex");return r.create=function(r){return new D(t,e,r)},r.update=function(t,e){return r.create(e).update(t)},C(r,x,t,e)}},{name:"cshake",padding:c,bits:y,createMethod:function(t,e){var r=k[t],n=m(t,0,"hex");return n.create=function(n,i,o){return _(i)&&_(o)?R["shake"+t].create(n):new D(t,e,n).bytepad([i,o],r)},n.update=function(t,e,r,i){return n.create(e,r,i).update(t)},C(n,m,t,e)}},{name:"kmac",padding:c,bits:y,createMethod:function(t,e){var r=k[t],n=S(t,0,"hex");return n.create=function(n,i,o){return new L(t,e,i).bytepad(["KMAC",o],r).bytepad([n],r)},n.update=function(t,e,r,i){return n.create(t,r,i).update(e)},C(n,S,t,e)}},{name:"tuplehash",padding:c,bits:y,createMethod:function(t,e){return M(t,e,!1)}},{name:"tuplehashxof",padding:c,bits:y,createMethod:function(t,e){return M(t,e,!0)}}],R={},N=[],J=0;J<O.length;++J)for(var j=O[J],I=j.bits,H=0;H<I.length;++H){var F=j.name+"_"+I[H];if(N.push(F),R[F]=j.createMethod(I[H],j.padding),"sha3"!==j.name){var U=j.name+I[H];N.push(U),R[U]=R[F]}}function D(t,e,r){this.blocks=[],this.s=[],this.padding=e,this.outputBits=r,this.reset=!0,this.finalized=!1,this.block=0,this.start=0,this.blockCount=1600-(t<<1)>>5,this.byteCount=this.blockCount<<2,this.outputBlocks=r>>5,this.extraBytes=(31&r)>>3;for(var n=0;n<50;++n)this.s[n]=0}function L(t,e,r){D.call(this,t,e,r)}function T(t,e,r,n){D.call(this,t,e,r),this.xof=!!n,this.inputActive=!1,this.inputBytesRemaining=0}D.prototype.update=function(t){if(this.finalized)throw new Error(n);var e=w(t);t=e[0];for(var r,i,o=e[1],a=this.blocks,s=this.byteCount,u=t.length,h=this.blockCount,f=0,c=this.s;f<u;){if(this.reset)for(this.reset=!1,a[0]=this.block,r=1;r<h+1;++r)a[r]=0;if(o)for(r=this.start;f<u&&r<s;++f)(i=t.charCodeAt(f))<128?a[r>>2]|=i<<p[3&r++]:i<2048?(a[r>>2]|=(192|i>>6)<<p[3&r++],a[r>>2]|=(128|63&i)<<p[3&r++]):i<55296||i>=57344?(a[r>>2]|=(224|i>>12)<<p[3&r++],a[r>>2]|=(128|i>>6&63)<<p[3&r++],a[r>>2]|=(128|63&i)<<p[3&r++]):(i=65536+((1023&i)<<10|1023&t.charCodeAt(++f)),a[r>>2]|=(240|i>>18)<<p[3&r++],a[r>>2]|=(128|i>>12&63)<<p[3&r++],a[r>>2]|=(128|i>>6&63)<<p[3&r++],a[r>>2]|=(128|63&i)<<p[3&r++]);else for(r=this.start;f<u&&r<s;++f)a[r>>2]|=t[f]<<p[3&r++];if(this.lastByteIndex=r,r>=s){for(this.start=r-s,this.block=a[h],r=0;r<h;++r)c[r]^=a[r];V(c),this.reset=!0}else this.start=r}return this},D.prototype.encode=function(t,e){var r=255&t,n=1,i=[r];for(r=255&(t>>=8);r>0;)i.unshift(r),r=255&(t>>=8),++n;return e?i.push(n):i.unshift(n),D.prototype.update.call(this,i),i.length},D.prototype.encodeString=function(t){var e=w(t);t=e[0];var r=e[1],n=0,i=t.length;if(r)for(var o=0;o<t.length;++o){var a=t.charCodeAt(o);a<128?n+=1:a<2048?n+=2:a<55296||a>=57344?n+=3:(a=65536+((1023&a)<<10|1023&t.charCodeAt(++o)),n+=4)}else n=i;return n+=this.encode(8*n),D.prototype.update.call(this,t),n},D.prototype.bytepad=function(t,e){for(var r=this.encode(e),n=0;n<t.length;++n)r+=this.encodeString(t[n]);var i=(e-r%e)%e,o=[];return o.length=i,D.prototype.update.call(this,o),this},D.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var t=this.blocks,e=this.lastByteIndex,r=this.blockCount,n=this.s;if(t[e>>2]|=this.padding[3&e],this.lastByteIndex===this.byteCount)for(t[0]=t[r],e=1;e<r+1;++e)t[e]=0;for(t[r-1]|=2147483648,e=0;e<r;++e)n[e]^=t[e];V(n)}},D.prototype.toString=D.prototype.hex=function(){this.finalize();for(var t,e=this.blockCount,r=this.s,n=this.outputBlocks,i=this.extraBytes,o=0,a=0,s="";a<n;){for(o=0;o<e&&a<n;++o,++a)t=r[o],s+=f[t>>4&15]+f[15&t]+f[t>>12&15]+f[t>>8&15]+f[t>>20&15]+f[t>>16&15]+f[t>>28&15]+f[t>>24&15];a%e===0&&(r=A(r),V(r),o=0)}return i&&(t=r[o],s+=f[t>>4&15]+f[15&t],i>1&&(s+=f[t>>12&15]+f[t>>8&15]),i>2&&(s+=f[t>>20&15]+f[t>>16&15])),s},D.prototype.arrayBuffer=function(){this.finalize();var t,e=this.blockCount,r=this.s,n=this.outputBlocks,i=this.extraBytes,o=0,a=0,s=this.outputBits>>3;t=i?new ArrayBuffer(n+1<<2):new ArrayBuffer(s);for(var u=new Uint32Array(t);a<n;){for(o=0;o<e&&a<n;++o,++a)u[a]=r[o];a%e===0&&(r=A(r),V(r))}return i&&(u[a]=r[o],t=t.slice(0,s)),t},D.prototype.buffer=D.prototype.arrayBuffer,D.prototype.digest=D.prototype.array=function(){this.finalize();for(var t,e,r=this.blockCount,n=this.s,i=this.outputBlocks,o=this.extraBytes,a=0,s=0,u=[];s<i;){for(a=0;a<r&&s<i;++a,++s)t=s<<2,e=n[a],u[t]=255&e,u[t+1]=e>>8&255,u[t+2]=e>>16&255,u[t+3]=e>>24&255;s%r===0&&(n=A(n),V(n))}return o&&(t=s<<2,e=n[a],u[t]=255&e,o>1&&(u[t+1]=e>>8&255),o>2&&(u[t+2]=e>>16&255)),u},L.prototype=new D,L.prototype.finalize=function(){return this.finalized||this.encode(this.outputBits,!0),D.prototype.finalize.call(this)},T.prototype=new D,T.prototype.getMessageByteLength=function(t){var e=w(t);if(t=e[0],!e[1])return t.length;for(var r=0,n=0;n<t.length;++n){var i=t.charCodeAt(n);i<128?r+=1:i<2048?r+=2:i<55296||i>=57344?r+=3:(++n,r+=4)}return r},T.prototype.beginInput=function(t){if(this.finalized)throw new Error(n);if(this.inputActive)throw new Error(i);if("number"!=typeof t||!isFinite(t)||t<0||Math.floor(t)!==t||t>268435455)throw new Error("tuple input byte length is invalid");return this.encode(8*t,!1),0===t?(this.inputActive=!1,this.inputBytesRemaining=0):(this.inputActive=!0,this.inputBytesRemaining=t),this},T.prototype.updateChunk=function(t){if(this.finalized)throw new Error(n);if(!this.inputActive)throw new Error("no active tuple input");var e=this.getMessageByteLength(t);if(e>this.inputBytesRemaining)throw new Error("tuple input exceeds declared length");return D.prototype.update.call(this,t),this.inputBytesRemaining-=e,0===this.inputBytesRemaining&&(this.inputActive=!1),this},T.prototype.update=function(t){if(this.finalized)throw new Error(n);if(this.inputActive)throw new Error(i);var e=this.getMessageByteLength(t);return this.beginInput(e),0===e?this:this.updateChunk(t)},T.prototype.finalize=function(){if(this.inputActive)throw new Error(i);return this.finalized||this.encode(this.xof?0:this.outputBits,!0),D.prototype.finalize.call(this)};var V=function(t){var e,r,n,i,o,a,s,u,h,f,c,p,d,y,g,k,v,b,w,_,A,B,x,m,S,C,z,E,M,O,R,N,J,j,I,H,F,U,D,L,T,V,W,Y,K,P,q,G,Q,X,Z,$,tt,et,rt,nt,it,ot,at,st,ut,ht,ft;for(n=0;n<48;n+=2)i=t[0]^t[10]^t[20]^t[30]^t[40],o=t[1]^t[11]^t[21]^t[31]^t[41],a=t[2]^t[12]^t[22]^t[32]^t[42],s=t[3]^t[13]^t[23]^t[33]^t[43],u=t[4]^t[14]^t[24]^t[34]^t[44],h=t[5]^t[15]^t[25]^t[35]^t[45],f=t[6]^t[16]^t[26]^t[36]^t[46],c=t[7]^t[17]^t[27]^t[37]^t[47],e=(p=t[8]^t[18]^t[28]^t[38]^t[48])^(a<<1|s>>>31),r=(d=t[9]^t[19]^t[29]^t[39]^t[49])^(s<<1|a>>>31),t[0]^=e,t[1]^=r,t[10]^=e,t[11]^=r,t[20]^=e,t[21]^=r,t[30]^=e,t[31]^=r,t[40]^=e,t[41]^=r,e=i^(u<<1|h>>>31),r=o^(h<<1|u>>>31),t[2]^=e,t[3]^=r,t[12]^=e,t[13]^=r,t[22]^=e,t[23]^=r,t[32]^=e,t[33]^=r,t[42]^=e,t[43]^=r,e=a^(f<<1|c>>>31),r=s^(c<<1|f>>>31),t[4]^=e,t[5]^=r,t[14]^=e,t[15]^=r,t[24]^=e,t[25]^=r,t[34]^=e,t[35]^=r,t[44]^=e,t[45]^=r,e=u^(p<<1|d>>>31),r=h^(d<<1|p>>>31),t[6]^=e,t[7]^=r,t[16]^=e,t[17]^=r,t[26]^=e,t[27]^=r,t[36]^=e,t[37]^=r,t[46]^=e,t[47]^=r,e=f^(i<<1|o>>>31),r=c^(o<<1|i>>>31),t[8]^=e,t[9]^=r,t[18]^=e,t[19]^=r,t[28]^=e,t[29]^=r,t[38]^=e,t[39]^=r,t[48]^=e,t[49]^=r,y=t[0],g=t[1],P=t[11]<<4|t[10]>>>28,q=t[10]<<4|t[11]>>>28,E=t[20]<<3|t[21]>>>29,M=t[21]<<3|t[20]>>>29,st=t[31]<<9|t[30]>>>23,ut=t[30]<<9|t[31]>>>23,V=t[40]<<18|t[41]>>>14,W=t[41]<<18|t[40]>>>14,j=t[2]<<1|t[3]>>>31,I=t[3]<<1|t[2]>>>31,k=t[13]<<12|t[12]>>>20,v=t[12]<<12|t[13]>>>20,G=t[22]<<10|t[23]>>>22,Q=t[23]<<10|t[22]>>>22,O=t[33]<<13|t[32]>>>19,R=t[32]<<13|t[33]>>>19,ht=t[42]<<2|t[43]>>>30,ft=t[43]<<2|t[42]>>>30,et=t[5]<<30|t[4]>>>2,rt=t[4]<<30|t[5]>>>2,H=t[14]<<6|t[15]>>>26,F=t[15]<<6|t[14]>>>26,b=t[25]<<11|t[24]>>>21,w=t[24]<<11|t[25]>>>21,X=t[34]<<15|t[35]>>>17,Z=t[35]<<15|t[34]>>>17,N=t[45]<<29|t[44]>>>3,J=t[44]<<29|t[45]>>>3,m=t[6]<<28|t[7]>>>4,S=t[7]<<28|t[6]>>>4,nt=t[17]<<23|t[16]>>>9,it=t[16]<<23|t[17]>>>9,U=t[26]<<25|t[27]>>>7,D=t[27]<<25|t[26]>>>7,_=t[36]<<21|t[37]>>>11,A=t[37]<<21|t[36]>>>11,$=t[47]<<24|t[46]>>>8,tt=t[46]<<24|t[47]>>>8,Y=t[8]<<27|t[9]>>>5,K=t[9]<<27|t[8]>>>5,C=t[18]<<20|t[19]>>>12,z=t[19]<<20|t[18]>>>12,ot=t[29]<<7|t[28]>>>25,at=t[28]<<7|t[29]>>>25,L=t[38]<<8|t[39]>>>24,T=t[39]<<8|t[38]>>>24,B=t[48]<<14|t[49]>>>18,x=t[49]<<14|t[48]>>>18,t[0]=y^~k&b,t[1]=g^~v&w,t[10]=m^~C&E,t[11]=S^~z&M,t[20]=j^~H&U,t[21]=I^~F&D,t[30]=Y^~P&G,t[31]=K^~q&Q,t[40]=et^~nt&ot,t[41]=rt^~it&at,t[2]=k^~b&_,t[3]=v^~w&A,t[12]=C^~E&O,t[13]=z^~M&R,t[22]=H^~U&L,t[23]=F^~D&T,t[32]=P^~G&X,t[33]=q^~Q&Z,t[42]=nt^~ot&st,t[43]=it^~at&ut,t[4]=b^~_&B,t[5]=w^~A&x,t[14]=E^~O&N,t[15]=M^~R&J,t[24]=U^~L&V,t[25]=D^~T&W,t[34]=G^~X&$,t[35]=Q^~Z&tt,t[44]=ot^~st&ht,t[45]=at^~ut&ft,t[6]=_^~B&y,t[7]=A^~x&g,t[16]=O^~N&m,t[17]=R^~J&S,t[26]=L^~V&j,t[27]=T^~W&I,t[36]=X^~$&Y,t[37]=Z^~tt&K,t[46]=st^~ht&et,t[47]=ut^~ft&rt,t[8]=B^~y&k,t[9]=x^~g&v,t[18]=N^~m&C,t[19]=J^~S&z,t[28]=V^~j&H,t[29]=W^~I&F,t[38]=$^~Y&P,t[39]=tt^~K&q,t[48]=ht^~et&nt,t[49]=ft^~rt&it,t[0]^=l[n],t[1]^=l[n+1]};if(u)r.exports=R;else for(J=0;J<N.length;++J)a[N[J]]=R[N[J]]}();var i=e(n.exports);const{sha3_224:o,sha3_256:a,sha3_384:s,sha3_512:u,keccak_224:h,keccak_256:f,keccak_384:c,keccak_512:p,keccak224:l,keccak256:d,keccak384:y,keccak512:g,shake_128:k,shake_256:v,shake128:b,shake256:w,cshake_128:_,cshake_256:A,cshake128:B,cshake256:x,kmac_128:m,kmac_256:S,kmac128:C,kmac256:z,tuplehash_128:E,tuplehash_256:M,tuplehash128:O,tuplehash256:R,tuplehashxof_128:N,tuplehashxof_256:J,tuplehashxof128:j,tuplehashxof256:I}=i;export{B as cshake128,x as cshake256,_ as cshake_128,A as cshake_256,i as default,l as keccak224,d as keccak256,y as keccak384,g as keccak512,h as keccak_224,f as keccak_256,c as keccak_384,p as keccak_512,C as kmac128,z as kmac256,m as kmac_128,S as kmac_256,o as sha3_224,a as sha3_256,s as sha3_384,u as sha3_512,b as shake128,w as shake256,k as shake_128,v as shake_256,O as tuplehash128,R as tuplehash256,E as tuplehash_128,M as tuplehash_256,j as tuplehashxof128,I as tuplehashxof256,N as tuplehashxof_128,J as tuplehashxof_256};
9
+ */r=n,function(){var e="input is invalid type",n="tuple input is incomplete",i="object"==typeof window,o=i?window:{};o.JS_SHA3_NO_WINDOW&&(i=!1);var a=!i&&"object"==typeof self;!o.JS_SHA3_NO_NODE_JS&&"object"==typeof process&&process.versions&&process.versions.node?o=t:a&&(o=self);for(var u=!o.JS_SHA3_NO_COMMON_JS&&r.exports,s=!o.JS_SHA3_NO_ARRAY_BUFFER&&"undefined"!=typeof ArrayBuffer,h="0123456789abcdef".split(""),f=[4,1024,262144,67108864],c=[0,8,16,24],p=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],l=[224,256,384,512],d=[128,256],y=["hex","buffer","arrayBuffer","array","digest"],k={128:168,256:136},g=o.JS_SHA3_NO_NODE_JS||!Array.isArray?function(t){return"[object Array]"===Object.prototype.toString.call(t)}:Array.isArray,v=!s||!o.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView?ArrayBuffer.isView:function(t){return"object"==typeof t&&t.buffer&&t.buffer.constructor===ArrayBuffer},b=function(t){var r=typeof t;if("string"===r)return[t,!0];if("object"!==r||null===t)throw new Error(e);if(s&&t.constructor===ArrayBuffer)return[new Uint8Array(t),!1];if(!g(t)&&!v(t))throw new Error(e);return[t,!1]},_=function(t){return 0===b(t)[0].length},w=function(t){for(var e=[],r=0;r<t.length;++r)e[r]=t[r];return e},A=function(t,e,r){return function(n){return new D(t,e,t).update(n)[r]()}},x=function(t,e,r){return function(n,i){return new D(t,e,i).update(n)[r]()}},B=function(t,e,r){return function(e,n,i,o){return R["cshake"+t].update(e,n,i,o)[r]()}},m=function(t,e,r,n){return function(e,i,o,a){return R[(r?"kmacxof":"kmac")+t].update(e,i,o,a)[n]()}},C=function(t,e,r,n){return function(e,i,o){return R[(r?"tuplehashxof":"tuplehash")+t].update(e,i,o)[n]()}},S=function(t,e,r,n){for(var i=0;i<y.length;++i){var o=y[i];t[o]=e(r,n,o)}return t},M=function(t,e){var r=A(t,e,"hex");return r.create=function(){return new D(t,e,t)},r.update=function(t){return r.create().update(t)},S(r,A,t,e)},z=function(t,e,r){var n=k[t],i=m(t,0,r,"hex");return i.create=function(i,o,a){return new L(t,e,o,r).bytepad(["KMAC",a],n).bytepad([i],n)},i.update=function(t,e,r,n){return i.create(t,r,n).update(e)},S(i,function(t,e,n){return m(t,0,r,n)},t,e)},E=function(t,r,n){var i=k[t],o=C(t,0,n,"hex");return o.create=function(e,o){return new T(t,r,e,n).bytepad(["TupleHash",o],i)},o.update=function(t,r,n){if(!g(t))throw new Error(e);for(var i=o.create(r,n),a=0;a<t.length;++a)i.update(t[a]);return i},S(o,function(t,e,r){return C(t,0,n,r)},t,r)},O=[{name:"keccak",padding:[1,256,65536,16777216],bits:l,createMethod:M},{name:"sha3",padding:[6,1536,393216,100663296],bits:l,createMethod:M},{name:"shake",padding:[31,7936,2031616,520093696],bits:d,createMethod:function(t,e){var r=x(t,e,"hex");return r.create=function(r){return new D(t,e,r)},r.update=function(t,e){return r.create(e).update(t)},S(r,x,t,e)}},{name:"cshake",padding:f,bits:d,createMethod:function(t,e){var r=k[t],n=B(t,0,"hex");return n.create=function(n,i,o){return _(i)&&_(o)?R["shake"+t].create(n):new D(t,e,n).bytepad([i,o],r)},n.update=function(t,e,r,i){return n.create(e,r,i).update(t)},S(n,B,t,e)}},{name:"kmac",padding:f,bits:d,createMethod:function(t,e){return z(t,e,!1)}},{name:"kmacxof",padding:f,bits:d,createMethod:function(t,e){return z(t,e,!0)}},{name:"tuplehash",padding:f,bits:d,createMethod:function(t,e){return E(t,e,!1)}},{name:"tuplehashxof",padding:f,bits:d,createMethod:function(t,e){return E(t,e,!0)}}],R={},N=[],J=0;J<O.length;++J)for(var j=O[J],I=j.bits,H=0;H<I.length;++H){var F=j.name+"_"+I[H];if(N.push(F),R[F]=j.createMethod(I[H],j.padding),"sha3"!==j.name){var U=j.name+I[H];N.push(U),R[U]=R[F]}}function D(t,e,r){this.blocks=[],this.s=[],this.padding=e,this.outputBits=r,this.reset=!0,this.finalized=!1,this.block=0,this.start=0,this.blockCount=1600-(t<<1)>>5,this.byteCount=this.blockCount<<2,this.outputBlocks=r>>5,this.extraBytes=(31&r)>>3;for(var n=0;n<50;++n)this.s[n]=0}function L(t,e,r,n){D.call(this,t,e,r),this.xof=n}function T(t,e,r,n){L.call(this,t,e,r,n),this.inputActive=!1,this.inputBytesRemaining=0}D.prototype.update=function(t){if(this.finalized)throw new Error("finalize already called");var e=b(t);t=e[0];for(var r,n,i=e[1],o=this.blocks,a=this.byteCount,u=t.length,s=this.blockCount,h=0,f=this.s;h<u;){if(this.reset)for(this.reset=!1,o[0]=this.block,r=1;r<s+1;++r)o[r]=0;if(i)for(r=this.start;h<u&&r<a;++h)(n=t.charCodeAt(h))<128?o[r>>2]|=n<<c[3&r++]:n<2048?(o[r>>2]|=(192|n>>6)<<c[3&r++],o[r>>2]|=(128|63&n)<<c[3&r++]):n<55296||n>=57344?(o[r>>2]|=(224|n>>12)<<c[3&r++],o[r>>2]|=(128|n>>6&63)<<c[3&r++],o[r>>2]|=(128|63&n)<<c[3&r++]):(n=65536+((1023&n)<<10|1023&t.charCodeAt(++h)),o[r>>2]|=(240|n>>18)<<c[3&r++],o[r>>2]|=(128|n>>12&63)<<c[3&r++],o[r>>2]|=(128|n>>6&63)<<c[3&r++],o[r>>2]|=(128|63&n)<<c[3&r++]);else for(r=this.start;h<u&&r<a;++h)o[r>>2]|=t[h]<<c[3&r++];if(this.lastByteIndex=r,r>=a){for(this.start=r-a,this.block=o[s],r=0;r<s;++r)f[r]^=o[r];V(f),this.reset=!0}else this.start=r}return this},D.prototype.encode=function(t,e){var r=255&t,n=1,i=[r];for(r=255&(t>>=8);r>0;)i.unshift(r),r=255&(t>>=8),++n;return e?i.push(n):i.unshift(n),D.prototype.update.call(this,i),i.length},D.prototype.encodeString=function(t){var e=b(t);t=e[0];var r=e[1],n=0,i=t.length;if(r)for(var o=0;o<t.length;++o){var a=t.charCodeAt(o);a<128?n+=1:a<2048?n+=2:a<55296||a>=57344?n+=3:(a=65536+((1023&a)<<10|1023&t.charCodeAt(++o)),n+=4)}else n=i;return n+=this.encode(8*n),D.prototype.update.call(this,t),n},D.prototype.bytepad=function(t,e){for(var r=this.encode(e),n=0;n<t.length;++n)r+=this.encodeString(t[n]);var i=(e-r%e)%e,o=[];return o.length=i,D.prototype.update.call(this,o),this},D.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var t=this.blocks,e=this.lastByteIndex,r=this.blockCount,n=this.s;if(t[e>>2]|=this.padding[3&e],this.lastByteIndex===this.byteCount)for(t[0]=t[r],e=1;e<r+1;++e)t[e]=0;for(t[r-1]|=2147483648,e=0;e<r;++e)n[e]^=t[e];V(n)}},D.prototype.toString=D.prototype.hex=function(){this.finalize();for(var t,e=this.blockCount,r=this.s,n=this.outputBlocks,i=this.extraBytes,o=0,a=0,u="";a<n;){for(o=0;o<e&&a<n;++o,++a)t=r[o],u+=h[t>>4&15]+h[15&t]+h[t>>12&15]+h[t>>8&15]+h[t>>20&15]+h[t>>16&15]+h[t>>28&15]+h[t>>24&15];a%e===0&&(r=w(r),V(r),o=0)}return i&&(t=r[o],u+=h[t>>4&15]+h[15&t],i>1&&(u+=h[t>>12&15]+h[t>>8&15]),i>2&&(u+=h[t>>20&15]+h[t>>16&15])),u},D.prototype.arrayBuffer=function(){this.finalize();var t,e=this.blockCount,r=this.s,n=this.outputBlocks,i=this.extraBytes,o=0,a=0,u=this.outputBits>>3;t=i?new ArrayBuffer(n+1<<2):new ArrayBuffer(u);for(var s=new Uint32Array(t);a<n;){for(o=0;o<e&&a<n;++o,++a)s[a]=r[o];a%e===0&&(r=w(r),V(r))}return i&&(s[a]=r[o],t=t.slice(0,u)),t},D.prototype.buffer=D.prototype.arrayBuffer,D.prototype.digest=D.prototype.array=function(){this.finalize();for(var t,e,r=this.blockCount,n=this.s,i=this.outputBlocks,o=this.extraBytes,a=0,u=0,s=[];u<i;){for(a=0;a<r&&u<i;++a,++u)t=u<<2,e=n[a],s[t]=255&e,s[t+1]=e>>8&255,s[t+2]=e>>16&255,s[t+3]=e>>24&255;u%r===0&&(n=w(n),V(n))}return o&&(t=u<<2,e=n[a],s[t]=255&e,o>1&&(s[t+1]=e>>8&255),o>2&&(s[t+2]=e>>16&255)),s},L.prototype=new D,L.prototype.finalize=function(){return this.finalized||this.encode(this.xof?0:this.outputBits,!0),D.prototype.finalize.call(this)},T.prototype=new L,T.prototype.getMessageByteLength=function(t){var e=b(t);if(t=e[0],!e[1])return t.length;for(var r=0,n=0;n<t.length;++n){var i=t.charCodeAt(n);i<128?r+=1:i<2048?r+=2:i<55296||i>=57344?r+=3:(++n,r+=4)}return r},T.prototype.beginInput=function(t){if(this.inputActive)throw new Error(n);if("number"!=typeof t||!isFinite(t)||t<0||Math.floor(t)!==t||t>268435455)throw new Error("tuple input byte length is invalid");return this.encode(8*t,!1),0!==t&&(this.inputActive=!0,this.inputBytesRemaining=t),this},T.prototype._updateChunk=function(t,e){return L.prototype.update.call(this,t),this.inputBytesRemaining-=e,0===this.inputBytesRemaining&&(this.inputActive=!1),this},T.prototype.updateChunk=function(t){if(!this.inputActive)throw new Error("no active tuple input");var e=this.getMessageByteLength(t);if(e>this.inputBytesRemaining)throw new Error("tuple input exceeds declared length");return this._updateChunk(t,e)},T.prototype.update=function(t){var e=this.getMessageByteLength(t);return this.beginInput(e),this._updateChunk(t,e)},T.prototype.finalize=function(){if(this.inputActive)throw new Error(n);return L.prototype.finalize.call(this)};var V=function(t){var e,r,n,i,o,a,u,s,h,f,c,l,d,y,k,g,v,b,_,w,A,x,B,m,C,S,M,z,E,O,R,N,J,j,I,H,F,U,D,L,T,V,W,Y,K,P,q,G,Q,X,Z,$,tt,et,rt,nt,it,ot,at,ut,st,ht,ft;for(n=0;n<48;n+=2)i=t[0]^t[10]^t[20]^t[30]^t[40],o=t[1]^t[11]^t[21]^t[31]^t[41],a=t[2]^t[12]^t[22]^t[32]^t[42],u=t[3]^t[13]^t[23]^t[33]^t[43],s=t[4]^t[14]^t[24]^t[34]^t[44],h=t[5]^t[15]^t[25]^t[35]^t[45],f=t[6]^t[16]^t[26]^t[36]^t[46],c=t[7]^t[17]^t[27]^t[37]^t[47],e=(l=t[8]^t[18]^t[28]^t[38]^t[48])^(a<<1|u>>>31),r=(d=t[9]^t[19]^t[29]^t[39]^t[49])^(u<<1|a>>>31),t[0]^=e,t[1]^=r,t[10]^=e,t[11]^=r,t[20]^=e,t[21]^=r,t[30]^=e,t[31]^=r,t[40]^=e,t[41]^=r,e=i^(s<<1|h>>>31),r=o^(h<<1|s>>>31),t[2]^=e,t[3]^=r,t[12]^=e,t[13]^=r,t[22]^=e,t[23]^=r,t[32]^=e,t[33]^=r,t[42]^=e,t[43]^=r,e=a^(f<<1|c>>>31),r=u^(c<<1|f>>>31),t[4]^=e,t[5]^=r,t[14]^=e,t[15]^=r,t[24]^=e,t[25]^=r,t[34]^=e,t[35]^=r,t[44]^=e,t[45]^=r,e=s^(l<<1|d>>>31),r=h^(d<<1|l>>>31),t[6]^=e,t[7]^=r,t[16]^=e,t[17]^=r,t[26]^=e,t[27]^=r,t[36]^=e,t[37]^=r,t[46]^=e,t[47]^=r,e=f^(i<<1|o>>>31),r=c^(o<<1|i>>>31),t[8]^=e,t[9]^=r,t[18]^=e,t[19]^=r,t[28]^=e,t[29]^=r,t[38]^=e,t[39]^=r,t[48]^=e,t[49]^=r,y=t[0],k=t[1],P=t[11]<<4|t[10]>>>28,q=t[10]<<4|t[11]>>>28,z=t[20]<<3|t[21]>>>29,E=t[21]<<3|t[20]>>>29,ut=t[31]<<9|t[30]>>>23,st=t[30]<<9|t[31]>>>23,V=t[40]<<18|t[41]>>>14,W=t[41]<<18|t[40]>>>14,j=t[2]<<1|t[3]>>>31,I=t[3]<<1|t[2]>>>31,g=t[13]<<12|t[12]>>>20,v=t[12]<<12|t[13]>>>20,G=t[22]<<10|t[23]>>>22,Q=t[23]<<10|t[22]>>>22,O=t[33]<<13|t[32]>>>19,R=t[32]<<13|t[33]>>>19,ht=t[42]<<2|t[43]>>>30,ft=t[43]<<2|t[42]>>>30,et=t[5]<<30|t[4]>>>2,rt=t[4]<<30|t[5]>>>2,H=t[14]<<6|t[15]>>>26,F=t[15]<<6|t[14]>>>26,b=t[25]<<11|t[24]>>>21,_=t[24]<<11|t[25]>>>21,X=t[34]<<15|t[35]>>>17,Z=t[35]<<15|t[34]>>>17,N=t[45]<<29|t[44]>>>3,J=t[44]<<29|t[45]>>>3,m=t[6]<<28|t[7]>>>4,C=t[7]<<28|t[6]>>>4,nt=t[17]<<23|t[16]>>>9,it=t[16]<<23|t[17]>>>9,U=t[26]<<25|t[27]>>>7,D=t[27]<<25|t[26]>>>7,w=t[36]<<21|t[37]>>>11,A=t[37]<<21|t[36]>>>11,$=t[47]<<24|t[46]>>>8,tt=t[46]<<24|t[47]>>>8,Y=t[8]<<27|t[9]>>>5,K=t[9]<<27|t[8]>>>5,S=t[18]<<20|t[19]>>>12,M=t[19]<<20|t[18]>>>12,ot=t[29]<<7|t[28]>>>25,at=t[28]<<7|t[29]>>>25,L=t[38]<<8|t[39]>>>24,T=t[39]<<8|t[38]>>>24,x=t[48]<<14|t[49]>>>18,B=t[49]<<14|t[48]>>>18,t[0]=y^~g&b,t[1]=k^~v&_,t[10]=m^~S&z,t[11]=C^~M&E,t[20]=j^~H&U,t[21]=I^~F&D,t[30]=Y^~P&G,t[31]=K^~q&Q,t[40]=et^~nt&ot,t[41]=rt^~it&at,t[2]=g^~b&w,t[3]=v^~_&A,t[12]=S^~z&O,t[13]=M^~E&R,t[22]=H^~U&L,t[23]=F^~D&T,t[32]=P^~G&X,t[33]=q^~Q&Z,t[42]=nt^~ot&ut,t[43]=it^~at&st,t[4]=b^~w&x,t[5]=_^~A&B,t[14]=z^~O&N,t[15]=E^~R&J,t[24]=U^~L&V,t[25]=D^~T&W,t[34]=G^~X&$,t[35]=Q^~Z&tt,t[44]=ot^~ut&ht,t[45]=at^~st&ft,t[6]=w^~x&y,t[7]=A^~B&k,t[16]=O^~N&m,t[17]=R^~J&C,t[26]=L^~V&j,t[27]=T^~W&I,t[36]=X^~$&Y,t[37]=Z^~tt&K,t[46]=ut^~ht&et,t[47]=st^~ft&rt,t[8]=x^~y&g,t[9]=B^~k&v,t[18]=N^~m&S,t[19]=J^~C&M,t[28]=V^~j&H,t[29]=W^~I&F,t[38]=$^~Y&P,t[39]=tt^~K&q,t[48]=ht^~et&nt,t[49]=ft^~rt&it,t[0]^=p[n],t[1]^=p[n+1]};if(u)r.exports=R;else for(J=0;J<N.length;++J)o[N[J]]=R[N[J]]}();var i=e(n.exports);const{sha3_224:o,sha3_256:a,sha3_384:u,sha3_512:s,keccak_224:h,keccak_256:f,keccak_384:c,keccak_512:p,keccak224:l,keccak256:d,keccak384:y,keccak512:k,shake_128:g,shake_256:v,shake128:b,shake256:_,cshake_128:w,cshake_256:A,cshake128:x,cshake256:B,kmac_128:m,kmac_256:C,kmac128:S,kmac256:M,kmacxof_128:z,kmacxof_256:E,kmacxof128:O,kmacxof256:R,tuplehash_128:N,tuplehash_256:J,tuplehash128:j,tuplehash256:I,tuplehashxof_128:H,tuplehashxof_256:F,tuplehashxof128:U,tuplehashxof256:D}=i;export{x as cshake128,B as cshake256,w as cshake_128,A as cshake_256,i as default,l as keccak224,d as keccak256,y as keccak384,k as keccak512,h as keccak_224,f as keccak_256,c as keccak_384,p as keccak_512,S as kmac128,M as kmac256,m as kmac_128,C as kmac_256,O as kmacxof128,R as kmacxof256,z as kmacxof_128,E as kmacxof_256,o as sha3_224,a as sha3_256,u as sha3_384,s as sha3_512,b as shake128,_ as shake256,g as shake_128,v as shake_256,j as tuplehash128,I as tuplehash256,N as tuplehash_128,J as tuplehash_256,U as tuplehashxof128,D as tuplehashxof256,H as tuplehashxof_128,F as tuplehashxof_256};
package/build/sha3.mjs CHANGED
@@ -9,9 +9,9 @@ var sha3$1 = {exports: {}};
9
9
  /**
10
10
  * [js-sha3]{@link https://github.com/emn178/js-sha3}
11
11
  *
12
- * @version 0.11.0
12
+ * @version 0.12.0
13
13
  * @author Chen, Yi-Cyuan [emn178@gmail.com]
14
- * @copyright Chen, Yi-Cyuan 2015-2023
14
+ * @copyright Chen, Yi-Cyuan 2015-2026
15
15
  * @license MIT
16
16
  */
17
17
 
@@ -119,9 +119,15 @@ var sha3$1 = {exports: {}};
119
119
  };
120
120
  };
121
121
 
122
- var createKmacOutputMethod = function (bits, padding, outputType) {
122
+ var createKmacOutputMethod = function (bits, padding, xof, outputType) {
123
123
  return function (key, message, outputBits, s) {
124
- return methods['kmac' + bits].update(key, message, outputBits, s)[outputType]();
124
+ return methods[(xof ? 'kmacxof' : 'kmac') + bits].update(key, message, outputBits, s)[outputType]();
125
+ };
126
+ };
127
+
128
+ var createTupleHashOutputMethod = function (bits, padding, xof, outputType) {
129
+ return function (inputs, outputBits, s) {
130
+ return methods[(xof ? 'tuplehashxof' : 'tuplehash') + bits].update(inputs, outputBits, s)[outputType]();
125
131
  };
126
132
  };
127
133
 
@@ -171,22 +177,18 @@ var sha3$1 = {exports: {}};
171
177
  return createOutputMethods(method, createCshakeOutputMethod, bits, padding);
172
178
  };
173
179
 
174
- var createKmacMethod = function (bits, padding) {
180
+ var createKmacMethod = function (bits, padding, xof) {
175
181
  var w = CSHAKE_BYTEPAD[bits];
176
- var method = createKmacOutputMethod(bits, padding, 'hex');
182
+ var method = createKmacOutputMethod(bits, padding, xof, 'hex');
177
183
  method.create = function (key, outputBits, s) {
178
- return new Kmac(bits, padding, outputBits).bytepad(['KMAC', s], w).bytepad([key], w);
184
+ return new Kmac(bits, padding, outputBits, xof).bytepad(['KMAC', s], w).bytepad([key], w);
179
185
  };
180
186
  method.update = function (key, message, outputBits, s) {
181
187
  return method.create(key, outputBits, s).update(message);
182
188
  };
183
- return createOutputMethods(method, createKmacOutputMethod, bits, padding);
184
- };
185
-
186
- var createTupleHashOutputMethod = function (bits, padding, xof, outputType) {
187
- return function (inputs, outputBits, s) {
188
- return methods[(xof ? 'tuplehashxof' : 'tuplehash') + bits].update(inputs, outputBits, s)[outputType]();
189
- };
189
+ return createOutputMethods(method, function (b, p, outputType) {
190
+ return createKmacOutputMethod(b, p, xof, outputType);
191
+ }, bits, padding);
190
192
  };
191
193
 
192
194
  var createTupleHashMethod = function (bits, padding, xof) {
@@ -215,7 +217,12 @@ var sha3$1 = {exports: {}};
215
217
  { name: 'sha3', padding: PADDING, bits: BITS, createMethod: createMethod },
216
218
  { name: 'shake', padding: SHAKE_PADDING, bits: SHAKE_BITS, createMethod: createShakeMethod },
217
219
  { name: 'cshake', padding: CSHAKE_PADDING, bits: SHAKE_BITS, createMethod: createCshakeMethod },
218
- { name: 'kmac', padding: CSHAKE_PADDING, bits: SHAKE_BITS, createMethod: createKmacMethod },
220
+ { name: 'kmac', padding: CSHAKE_PADDING, bits: SHAKE_BITS, createMethod: function (bits, padding) {
221
+ return createKmacMethod(bits, padding, false);
222
+ }},
223
+ { name: 'kmacxof', padding: CSHAKE_PADDING, bits: SHAKE_BITS, createMethod: function (bits, padding) {
224
+ return createKmacMethod(bits, padding, true);
225
+ }},
219
226
  { name: 'tuplehash', padding: CSHAKE_PADDING, bits: SHAKE_BITS, createMethod: function (bits, padding) {
220
227
  return createTupleHashMethod(bits, padding, false);
221
228
  }},
@@ -496,27 +503,27 @@ var sha3$1 = {exports: {}};
496
503
  return array;
497
504
  };
498
505
 
499
- function Kmac(bits, padding, outputBits) {
506
+ function Kmac(bits, padding, outputBits, xof) {
500
507
  Keccak.call(this, bits, padding, outputBits);
508
+ this.xof = xof;
501
509
  }
502
510
 
503
511
  Kmac.prototype = new Keccak();
504
512
 
505
513
  Kmac.prototype.finalize = function () {
506
514
  if (!this.finalized) {
507
- this.encode(this.outputBits, true);
515
+ this.encode(this.xof ? 0 : this.outputBits, true);
508
516
  }
509
517
  return Keccak.prototype.finalize.call(this);
510
518
  };
511
519
 
512
520
  function TupleHash(bits, padding, outputBits, xof) {
513
- Keccak.call(this, bits, padding, outputBits);
514
- this.xof = !!xof;
521
+ Kmac.call(this, bits, padding, outputBits, xof);
515
522
  this.inputActive = false;
516
523
  this.inputBytesRemaining = 0;
517
524
  }
518
525
 
519
- TupleHash.prototype = new Keccak();
526
+ TupleHash.prototype = new Kmac();
520
527
 
521
528
  TupleHash.prototype.getMessageByteLength = function (message) {
522
529
  var result = formatMessage(message);
@@ -542,9 +549,6 @@ var sha3$1 = {exports: {}};
542
549
  };
543
550
 
544
551
  TupleHash.prototype.beginInput = function (byteLength) {
545
- if (this.finalized) {
546
- throw new Error(FINALIZE_ERROR);
547
- }
548
552
  if (this.inputActive) {
549
553
  throw new Error(TUPLE_INCOMPLETE_ERROR);
550
554
  }
@@ -553,20 +557,23 @@ var sha3$1 = {exports: {}};
553
557
  throw new Error(TUPLE_BYTE_LENGTH_ERROR);
554
558
  }
555
559
  this.encode(byteLength * 8, false);
556
- if (byteLength === 0) {
557
- this.inputActive = false;
558
- this.inputBytesRemaining = 0;
559
- } else {
560
+ if (byteLength !== 0) {
560
561
  this.inputActive = true;
561
562
  this.inputBytesRemaining = byteLength;
562
563
  }
563
564
  return this;
564
565
  };
565
566
 
566
- TupleHash.prototype.updateChunk = function (message) {
567
- if (this.finalized) {
568
- throw new Error(FINALIZE_ERROR);
567
+ TupleHash.prototype._updateChunk = function (message, byteLength) {
568
+ Kmac.prototype.update.call(this, message);
569
+ this.inputBytesRemaining -= byteLength;
570
+ if (this.inputBytesRemaining === 0) {
571
+ this.inputActive = false;
569
572
  }
573
+ return this;
574
+ };
575
+
576
+ TupleHash.prototype.updateChunk = function (message) {
570
577
  if (!this.inputActive) {
571
578
  throw new Error(TUPLE_ACTIVE_ERROR);
572
579
  }
@@ -574,37 +581,20 @@ var sha3$1 = {exports: {}};
574
581
  if (byteLength > this.inputBytesRemaining) {
575
582
  throw new Error(TUPLE_LENGTH_ERROR);
576
583
  }
577
- Keccak.prototype.update.call(this, message);
578
- this.inputBytesRemaining -= byteLength;
579
- if (this.inputBytesRemaining === 0) {
580
- this.inputActive = false;
581
- }
582
- return this;
584
+ return this._updateChunk(message, byteLength);
583
585
  };
584
586
 
585
587
  TupleHash.prototype.update = function (message) {
586
- if (this.finalized) {
587
- throw new Error(FINALIZE_ERROR);
588
- }
589
- if (this.inputActive) {
590
- throw new Error(TUPLE_INCOMPLETE_ERROR);
591
- }
592
588
  var byteLength = this.getMessageByteLength(message);
593
589
  this.beginInput(byteLength);
594
- if (byteLength === 0) {
595
- return this;
596
- }
597
- return this.updateChunk(message);
590
+ return this._updateChunk(message, byteLength);
598
591
  };
599
592
 
600
593
  TupleHash.prototype.finalize = function () {
601
594
  if (this.inputActive) {
602
595
  throw new Error(TUPLE_INCOMPLETE_ERROR);
603
596
  }
604
- if (!this.finalized) {
605
- this.encode(this.xof ? 0 : this.outputBits, true);
606
- }
607
- return Keccak.prototype.finalize.call(this);
597
+ return Kmac.prototype.finalize.call(this);
608
598
  };
609
599
 
610
600
  var f = function (s) {
@@ -834,6 +824,10 @@ const {
834
824
  kmac_256,
835
825
  kmac128,
836
826
  kmac256,
827
+ kmacxof_128,
828
+ kmacxof_256,
829
+ kmacxof128,
830
+ kmacxof256,
837
831
 
838
832
  tuplehash_128,
839
833
  tuplehash_256,
@@ -845,4 +839,4 @@ const {
845
839
  tuplehashxof256
846
840
  } = sha3;
847
841
 
848
- export { cshake128, cshake256, cshake_128, cshake_256, sha3 as default, keccak224, keccak256, keccak384, keccak512, keccak_224, keccak_256, keccak_384, keccak_512, kmac128, kmac256, kmac_128, kmac_256, sha3_224, sha3_256, sha3_384, sha3_512, shake128, shake256, shake_128, shake_256, tuplehash128, tuplehash256, tuplehash_128, tuplehash_256, tuplehashxof128, tuplehashxof256, tuplehashxof_128, tuplehashxof_256 };
842
+ export { cshake128, cshake256, cshake_128, cshake_256, sha3 as default, keccak224, keccak256, keccak384, keccak512, keccak_224, keccak_256, keccak_384, keccak_512, kmac128, kmac256, kmac_128, kmac_256, kmacxof128, kmacxof256, kmacxof_128, kmacxof_256, sha3_224, sha3_256, sha3_384, sha3_512, shake128, shake256, shake_128, shake_256, tuplehash128, tuplehash256, tuplehash_128, tuplehash_256, tuplehashxof128, tuplehashxof256, tuplehashxof_128, tuplehashxof_256 };
package/index.d.ts CHANGED
@@ -405,6 +405,10 @@ export var kmac_128: KmacHash;
405
405
  export var kmac_256: KmacHash;
406
406
  export var kmac128: KmacHash;
407
407
  export var kmac256: KmacHash;
408
+ export var kmacxof_128: KmacHash;
409
+ export var kmacxof_256: KmacHash;
410
+ export var kmacxof128: KmacHash;
411
+ export var kmacxof256: KmacHash;
408
412
  export var tuplehash_128: TupleHashMethod;
409
413
  export var tuplehash_256: TupleHashMethod;
410
414
  export var tuplehash128: TupleHashMethod;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "js-sha3",
3
- "version": "0.11.0",
3
+ "version": "0.12.0",
4
4
  "description": "A simple SHA-3 / Keccak / SHAKE / cSHAKE / KMAC / TupleHash hash function for JavaScript supports UTF-8 encoding.",
5
5
  "main": "src/sha3.js",
6
6
  "module": "build/sha3.mjs",
package/src/sha3.js CHANGED
@@ -1,9 +1,9 @@
1
1
  /**
2
2
  * [js-sha3]{@link https://github.com/emn178/js-sha3}
3
3
  *
4
- * @version 0.11.0
4
+ * @version 0.12.0
5
5
  * @author Chen, Yi-Cyuan [emn178@gmail.com]
6
- * @copyright Chen, Yi-Cyuan 2015-2023
6
+ * @copyright Chen, Yi-Cyuan 2015-2026
7
7
  * @license MIT
8
8
  */
9
9
  /*jslint bitwise: true */
@@ -111,9 +111,15 @@
111
111
  };
112
112
  };
113
113
 
114
- var createKmacOutputMethod = function (bits, padding, outputType) {
114
+ var createKmacOutputMethod = function (bits, padding, xof, outputType) {
115
115
  return function (key, message, outputBits, s) {
116
- return methods['kmac' + bits].update(key, message, outputBits, s)[outputType]();
116
+ return methods[(xof ? 'kmacxof' : 'kmac') + bits].update(key, message, outputBits, s)[outputType]();
117
+ };
118
+ };
119
+
120
+ var createTupleHashOutputMethod = function (bits, padding, xof, outputType) {
121
+ return function (inputs, outputBits, s) {
122
+ return methods[(xof ? 'tuplehashxof' : 'tuplehash') + bits].update(inputs, outputBits, s)[outputType]();
117
123
  };
118
124
  };
119
125
 
@@ -163,22 +169,18 @@
163
169
  return createOutputMethods(method, createCshakeOutputMethod, bits, padding);
164
170
  };
165
171
 
166
- var createKmacMethod = function (bits, padding) {
172
+ var createKmacMethod = function (bits, padding, xof) {
167
173
  var w = CSHAKE_BYTEPAD[bits];
168
- var method = createKmacOutputMethod(bits, padding, 'hex');
174
+ var method = createKmacOutputMethod(bits, padding, xof, 'hex');
169
175
  method.create = function (key, outputBits, s) {
170
- return new Kmac(bits, padding, outputBits).bytepad(['KMAC', s], w).bytepad([key], w);
176
+ return new Kmac(bits, padding, outputBits, xof).bytepad(['KMAC', s], w).bytepad([key], w);
171
177
  };
172
178
  method.update = function (key, message, outputBits, s) {
173
179
  return method.create(key, outputBits, s).update(message);
174
180
  };
175
- return createOutputMethods(method, createKmacOutputMethod, bits, padding);
176
- };
177
-
178
- var createTupleHashOutputMethod = function (bits, padding, xof, outputType) {
179
- return function (inputs, outputBits, s) {
180
- return methods[(xof ? 'tuplehashxof' : 'tuplehash') + bits].update(inputs, outputBits, s)[outputType]();
181
- };
181
+ return createOutputMethods(method, function (b, p, outputType) {
182
+ return createKmacOutputMethod(b, p, xof, outputType);
183
+ }, bits, padding);
182
184
  };
183
185
 
184
186
  var createTupleHashMethod = function (bits, padding, xof) {
@@ -207,7 +209,12 @@
207
209
  { name: 'sha3', padding: PADDING, bits: BITS, createMethod: createMethod },
208
210
  { name: 'shake', padding: SHAKE_PADDING, bits: SHAKE_BITS, createMethod: createShakeMethod },
209
211
  { name: 'cshake', padding: CSHAKE_PADDING, bits: SHAKE_BITS, createMethod: createCshakeMethod },
210
- { name: 'kmac', padding: CSHAKE_PADDING, bits: SHAKE_BITS, createMethod: createKmacMethod },
212
+ { name: 'kmac', padding: CSHAKE_PADDING, bits: SHAKE_BITS, createMethod: function (bits, padding) {
213
+ return createKmacMethod(bits, padding, false);
214
+ }},
215
+ { name: 'kmacxof', padding: CSHAKE_PADDING, bits: SHAKE_BITS, createMethod: function (bits, padding) {
216
+ return createKmacMethod(bits, padding, true);
217
+ }},
211
218
  { name: 'tuplehash', padding: CSHAKE_PADDING, bits: SHAKE_BITS, createMethod: function (bits, padding) {
212
219
  return createTupleHashMethod(bits, padding, false);
213
220
  }},
@@ -488,27 +495,27 @@
488
495
  return array;
489
496
  };
490
497
 
491
- function Kmac(bits, padding, outputBits) {
498
+ function Kmac(bits, padding, outputBits, xof) {
492
499
  Keccak.call(this, bits, padding, outputBits);
500
+ this.xof = xof;
493
501
  }
494
502
 
495
503
  Kmac.prototype = new Keccak();
496
504
 
497
505
  Kmac.prototype.finalize = function () {
498
506
  if (!this.finalized) {
499
- this.encode(this.outputBits, true);
507
+ this.encode(this.xof ? 0 : this.outputBits, true);
500
508
  }
501
509
  return Keccak.prototype.finalize.call(this);
502
510
  };
503
511
 
504
512
  function TupleHash(bits, padding, outputBits, xof) {
505
- Keccak.call(this, bits, padding, outputBits);
506
- this.xof = !!xof;
513
+ Kmac.call(this, bits, padding, outputBits, xof);
507
514
  this.inputActive = false;
508
515
  this.inputBytesRemaining = 0;
509
516
  }
510
517
 
511
- TupleHash.prototype = new Keccak();
518
+ TupleHash.prototype = new Kmac();
512
519
 
513
520
  TupleHash.prototype.getMessageByteLength = function (message) {
514
521
  var result = formatMessage(message);
@@ -534,9 +541,6 @@
534
541
  };
535
542
 
536
543
  TupleHash.prototype.beginInput = function (byteLength) {
537
- if (this.finalized) {
538
- throw new Error(FINALIZE_ERROR);
539
- }
540
544
  if (this.inputActive) {
541
545
  throw new Error(TUPLE_INCOMPLETE_ERROR);
542
546
  }
@@ -545,20 +549,23 @@
545
549
  throw new Error(TUPLE_BYTE_LENGTH_ERROR);
546
550
  }
547
551
  this.encode(byteLength * 8, false);
548
- if (byteLength === 0) {
549
- this.inputActive = false;
550
- this.inputBytesRemaining = 0;
551
- } else {
552
+ if (byteLength !== 0) {
552
553
  this.inputActive = true;
553
554
  this.inputBytesRemaining = byteLength;
554
555
  }
555
556
  return this;
556
557
  };
557
558
 
558
- TupleHash.prototype.updateChunk = function (message) {
559
- if (this.finalized) {
560
- throw new Error(FINALIZE_ERROR);
559
+ TupleHash.prototype._updateChunk = function (message, byteLength) {
560
+ Kmac.prototype.update.call(this, message);
561
+ this.inputBytesRemaining -= byteLength;
562
+ if (this.inputBytesRemaining === 0) {
563
+ this.inputActive = false;
561
564
  }
565
+ return this;
566
+ };
567
+
568
+ TupleHash.prototype.updateChunk = function (message) {
562
569
  if (!this.inputActive) {
563
570
  throw new Error(TUPLE_ACTIVE_ERROR);
564
571
  }
@@ -566,37 +573,20 @@
566
573
  if (byteLength > this.inputBytesRemaining) {
567
574
  throw new Error(TUPLE_LENGTH_ERROR);
568
575
  }
569
- Keccak.prototype.update.call(this, message);
570
- this.inputBytesRemaining -= byteLength;
571
- if (this.inputBytesRemaining === 0) {
572
- this.inputActive = false;
573
- }
574
- return this;
576
+ return this._updateChunk(message, byteLength);
575
577
  };
576
578
 
577
579
  TupleHash.prototype.update = function (message) {
578
- if (this.finalized) {
579
- throw new Error(FINALIZE_ERROR);
580
- }
581
- if (this.inputActive) {
582
- throw new Error(TUPLE_INCOMPLETE_ERROR);
583
- }
584
580
  var byteLength = this.getMessageByteLength(message);
585
581
  this.beginInput(byteLength);
586
- if (byteLength === 0) {
587
- return this;
588
- }
589
- return this.updateChunk(message);
582
+ return this._updateChunk(message, byteLength);
590
583
  };
591
584
 
592
585
  TupleHash.prototype.finalize = function () {
593
586
  if (this.inputActive) {
594
587
  throw new Error(TUPLE_INCOMPLETE_ERROR);
595
588
  }
596
- if (!this.finalized) {
597
- this.encode(this.xof ? 0 : this.outputBits, true);
598
- }
599
- return Keccak.prototype.finalize.call(this);
589
+ return Kmac.prototype.finalize.call(this);
600
590
  };
601
591
 
602
592
  var f = function (s) {
package/src/sha3.mjs CHANGED
@@ -29,6 +29,10 @@ export const {
29
29
  kmac_256,
30
30
  kmac128,
31
31
  kmac256,
32
+ kmacxof_128,
33
+ kmacxof_256,
34
+ kmacxof128,
35
+ kmacxof256,
32
36
 
33
37
  tuplehash_128,
34
38
  tuplehash_256,