hb_zhgd_screen/js/publics/sm3.js

1 line
3.3 KiB
JavaScript

!function(r,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.sm3=t():r.sm3=t()}("undefined"!=typeof self?self:this,function(){return function(r){function t(e){if(n[e])return n[e].exports;var o=n[e]={i:e,l:!1,exports:{}};return r[e].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var n={};return t.m=r,t.c=n,t.d=function(r,n,e){t.o(r,n)||Object.defineProperty(r,n,{configurable:!1,enumerable:!0,get:e})},t.n=function(r){var n=r&&r.__esModule?function(){return r.default}:function(){return r};return t.d(n,"a",n),n},t.o=function(r,t){return Object.prototype.hasOwnProperty.call(r,t)},t.p="",t(t.s=6)}({1:function(r,t,n){"use strict";function e(r,t){for(var n=[],e=~~(t/8),o=t%8,u=0,i=r.length;u<i;u++)n[u]=(r[(u+e)%i]<<o&255)+(r[(u+e+1)%i]>>>8-o&255);return n}function o(r,t){for(var n=[],e=r.length-1;e>=0;e--)n[e]=255&(r[e]^t[e]);return n}function u(r,t){for(var n=[],e=r.length-1;e>=0;e--)n[e]=r[e]&t[e]&255;return n}function i(r,t){for(var n=[],e=r.length-1;e>=0;e--)n[e]=255&(r[e]|t[e]);return n}function f(r,t){for(var n=[],e=0,o=r.length-1;o>=0;o--){var u=r[o]+t[o]+e;u>255?(e=1,n[o]=255&u):(e=0,n[o]=255&u)}return n}function s(r){for(var t=[],n=r.length-1;n>=0;n--)t[n]=255&~r[n];return t}function c(r){return o(o(r,e(r,9)),e(r,17))}function l(r){return o(o(r,e(r,15)),e(r,23))}function p(r,t,n,e){return e>=0&&e<=15?o(o(r,t),n):i(i(u(r,t),u(r,n)),u(t,n))}function a(r,t,n,e){return e>=0&&e<=15?o(o(r,t),n):i(u(r,t),u(s(r),n))}function h(r,t){for(var n=[],u=[],i=0;i<16;i++){var s=4*i;n.push(t.slice(s,s+4))}for(var h=16;h<68;h++)n.push(o(o(l(o(o(n[h-16],n[h-9]),e(n[h-3],15))),e(n[h-13],7)),n[h-6]));for(var v=0;v<64;v++)u.push(o(n[v],n[v+4]));for(var d=[121,204,69,25],g=[122,135,157,138],y=r.slice(0,4),x=r.slice(4,8),b=r.slice(8,12),m=r.slice(12,16),j=r.slice(16,20),w=r.slice(20,24),A=r.slice(24,28),O=r.slice(28,32),P=void 0,I=void 0,S=void 0,_=void 0,E=0;E<64;E++){var M=E>=0&&E<=15?d:g;P=e(f(f(e(y,12),j),e(M,E)),7),I=o(P,e(y,12)),S=f(f(f(p(y,x,b,E),m),I),u[E]),_=f(f(f(a(j,w,A,E),O),P),n[E]),m=b,b=e(x,9),x=y,y=S,O=A,A=e(w,19),w=j,j=c(_)}return o([].concat(y,x,b,m,j,w,A,O),r)}r.exports=function(r){var t=8*r.length,n=t%512;n=n>=448?512-n%448-1:448-n-1;for(var e=new Array((n-7)/8),o=0,u=e.length;o<u;o++)e[o]=0;var i=[];t=t.toString(2);for(var f=7;f>=0;f--)if(t.length>8){var s=t.length-8;i[f]=parseInt(t.substr(s),2),t=t.substr(0,s)}else t.length>0?(i[f]=parseInt(t,2),t=""):i[f]=0;for(var c=[].concat(r,[128],e,i),l=c.length/64,p=[115,128,22,111,73,20,178,185,23,36,66,215,218,138,6,0,169,111,48,188,22,49,56,170,227,141,238,77,176,251,14,78],a=0;a<l;a++){var v=64*a;p=h(p,c.slice(v,v+64))}return p}},6:function(r,t,n){"use strict";function e(r){return r.map(function(r){return r=r.toString(16),1===r.length?"0"+r:r}).join("")}function o(r){for(var t=[],n=0,e=r.length;n<e;n++){var o=r.codePointAt(n);if(o<=127)t.push(o);else if(o<=2047)t.push(192|o>>>6),t.push(128|63&o);else if(o<=55295||o>=57344&&o<=65535)t.push(224|o>>>12),t.push(128|o>>>6&63),t.push(128|63&o);else{if(!(o>=65536&&o<=1114111))throw t.push(o),new Error("input is not supported");n++,t.push(240|o>>>18&28),t.push(128|o>>>12&63),t.push(128|o>>>6&63),t.push(128|63&o)}}return t}var u=n(1);r.exports=function(r){return r="string"==typeof r?o(r):Array.prototype.slice.call(r),e(u(r))}}})});