/** * A JavaScript implementation of the SHA family of hashes - defined in FIPS PUB 180-4, FIPS PUB 202, * and SP 800-185 - as well as the corresponding HMAC implementation as defined in FIPS PUB 198-1. * * Copyright 2008-2021 Brian Turek, 1998-2009 Paul Johnston & Contributors * Distributed under the BSD License * See http://caligatio.github.com/jsSHA/ for more information * * Two ECMAScript polyfill functions carry the following license: * * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 * * THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, * INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, * MERCHANTABLITY OR NON-INFRINGEMENT. * * See the Apache Version 2.0 License for specific language governing permissions and limitations under the License. */ !function(t,r){"object"==typeof exports&&"undefined"!=typeof module?module.exports=r():"function"==typeof define&&define.amd?define(r):(t="undefined"!=typeof globalThis?globalThis:t||self).jsSHA=r()}(this,function(){"use strict";var t=function(r,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r}||function(t,r){for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])})(r,n)},r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",n="ARRAYBUFFER not supported by this environment",e="UINT8ARRAY not supported by this environment";function o(t,r,n,e){var o,i,u,s=r||[0],h=(n=n||0)>>>3,a=-1===e?3:0;for(o=0;o>>2,s.length<=i&&s.push(0),s[i]|=t[o]<<8*(a+e*(u%4));return{value:s,binLen:8*t.length+n}}function i(t,i,u){switch(i){case"UTF8":case"UTF16BE":case"UTF16LE":break;default:throw new Error("encoding must be UTF8, UTF16BE, or UTF16LE")}switch(t){case"HEX":return function(t,r,n){return function(t,r,n,e){var o,i,u,s;if(0!=t.length%2)throw new Error("String of HEX type must be in byte increments");var h=r||[0],a=(n=n||0)>>>3,f=-1===e?3:0;for(o=0;o>>1)+a)>>>2;h.length<=u;)h.push(0);h[u]|=i<<8*(f+e*(s%4))}return{value:h,binLen:4*t.length+n}}(t,r,n,u)};case"TEXT":return function(t,r,n){return function(t,r,n,e,o){var i,u,s,h,a,f,c,p,l=0,w=n||[0],d=(e=e||0)>>>3;if("UTF8"===r)for(c=-1===o?3:0,s=0;s(i=t.charCodeAt(s))?u.push(i):2048>i?(u.push(192|i>>>6),u.push(128|63&i)):55296>i||57344<=i?u.push(224|i>>>12,128|i>>>6&63,128|63&i):(s+=1,i=65536+((1023&i)<<10|1023&t.charCodeAt(s)),u.push(240|i>>>18,128|i>>>12&63,128|i>>>6&63,128|63&i)),h=0;h>>2;w.length<=a;)w.push(0);w[a]|=u[h]<<8*(c+o*(f%4)),l+=1}else for(c=-1===o?2:0,p="UTF16LE"===r&&1!==o||"UTF16LE"!==r&&1===o,s=0;s>>8),a=(f=l+d)>>>2;w.length<=a;)w.push(0);w[a]|=i<<8*(c+o*(f%4)),l+=2}return{value:w,binLen:8*l+e}}(t,i,r,n,u)};case"B64":return function(t,n,e){return function(t,n,e,o){var i,u,s,h,a,f,c=0,p=n||[0],l=(e=e||0)>>>3,w=-1===o?3:0,d=t.indexOf("=");if(-1===t.search(/^[a-zA-Z0-9=+/]+$/))throw new Error("Invalid character in base-64 string");if(t=t.replace(/=/g,""),-1!==d&&d