cosmos-explorer/externals/msrCrypto.js

20 lines
86 KiB
JavaScript
Raw Normal View History

//*******************************************************************************
//
// Copyright 2014 Microsoft
//
// 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
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
//*******************************************************************************
var msrCryptoVersion="1.4",msrCrypto=msrCrypto||function(){"use strict";function gt(){function f(n){var t,i=null;if(arguments.length&&typeof arguments[0]!="number"){if(typeof arguments[0]=="object")for(i=new Array(n.length),t=0;t<n.length;t+=1)i[t]=n[t]}else for(i=new Array(n),t=0;t<n;t+=1)i[t]=0;return i}function tt(n){for(var i=new Array(n.length),t=0;t<n.length;)i[t]=n[n.length-t-1],t+=1;return i}function ot(n,t){var i,f,r,e;for(n=n.replace(/^\s+|\s+$/g,""),i=[0],f=[0],t=t||10,r=0;r<n.length;r+=1){if(e=parseInt(n[r],t),isNaN(e))throw new Error("Failed to convert string to integer in radix "+t.toString());a(i,t,f);b(f,[e],i);u(i)}return i}function st(n,t){var l,a,y;if(t=t||10,r<=t)throw new Error("DIGIT_BASE is smaller than RADIX; cannot convert.");var p=n.length,h=[],v=[],w=[],b=[],o=[],e=[],f,i="",c="0";for(o[0]=t;Math.floor(r/o[0])>=t;)o[0]=o[0]*t,c=c.concat("0");for(f=0;f<p;f+=1)e[f]=n[f];do{for(l=!0,f=0;f<e.length;f+=1)if(e[f]!==0){l=!1;break}if(l)break;s(e,o,h,v,w,b);u(h,e.length,!0);a=v[0].toString(t);i=c.substring(0,c.length-a.length)+a+i;y=e;e=h;h=y}while(1);while(i.length!==0&&i[0]==="0")i=i.substring(1,i.length);return i.length===0&&(i="0"),i}function ht(n){var i=Math.ceil((n+1)/8),t=f(i);return t[0]=Math.pow(2,n%8),t}function ct(n){for(var r=f(n.length*8),u=0,i=n.length-1,t;i>=0;){for(t=0;t<8;){var e=1<<t,o=(n[i]&e)===e?1:0,s=8*(n.length-i-1)+t;o===1&&(u=s+1);r[s]=o;t+=1}i--}return r.slice(0,u)}function it(n){for(var i=r>>>1,u=t;u-->0;){if((n&i)===i)break;i=i>>>1}return u}function lt(n){for(var r=0,t=0,i,u;r<n.length;){if(t===0)for(i=7;i>=0&&t===0;)u=1<<i,(n[r]&u)===u&&(t=i+1),i--;else t+=8;r+=1}return t}function at(t,i,r){var u;t=t.slice();var f=[],e=Math.pow(2,i),o=Math.pow(2,i-1);for(u=0;u<r;u++)f[u]=t[0]%e-o,t[0]=t[0]-f[u],n.shiftRight(t,t,i-1);return f[u]=t[0],f}function e(n,t,i,r,u){while(u-->0)i[r+u]=n[t+u]}function w(n){for(var t=0;t<n.length;t+=1)if(n[t]!==0)return!1;return!0}function vt(n){return(n[0]&1)==0}function yt(n,t){if(n.length!==t.length)return!1;for(var i=0;i<n.length;i+=1)if(n[i]!==t[i])return!1;return!0}function d(n){var o=Math.floor((n.length+h-1)/h),i=new Array(o),u;i[0]=0;var t=0,e=0,f=0;for(u=n.length-1;u>=0;u--)t=t+v[f++]*(n[u]&255),v[f]===r&&(f=0,i[e++]=t,t=0);return t!==0&&(i[e]=t),i}function pt(n,t,i){var u,f,e,r=[0];for(typeof t=="undefined"&&(t=!0),u=0;u<n.length;u+=1)for(e=n[u],f=0;f<h;f+=1)r[u*h+f]=e&255,e=Math.floor(e/256);if(r=tt(r),i===undefined&&(i=1),t)while(r.length>i&&r[0]===0)r.shift();return r}function l(n,i){var f,u;for(typeof i=="undefined"&&(n<=1?i=1:(f=Math.log(n)/Math.LN2,i=Math.ceil(f/t))),u=[];n>0;)u.push(n%r),n=Math.floor(n/r);while(u.length<i)u.push(0);return u}function c(n){for(var t=n.length-1;t>=0;t--)if(n[t]!==undefined&&n[t]!==0)return t;return n[0]===0?-1:0}function o(n,t){var i=0,r=c(n)+1,u=c(t)+1;if(r>u)i=1;else if(u>r)i=-1;else while(r-->0&&i===0)i=n[r]-t[r];return i}function u(n,t,i){var r=c(n);if(n.length=t||r+1,i)while(++r<n.length)n[r]=0;return n.length<=0&&(n[0]=0,n.length=1),n}function wt(n,r,u,f){var o,s,e;if(u===undefined)u=1;else if(u>=t||u<0)throw new Error("Invalid bit count for shiftRight");for(f===undefined&&(f=n.length),o=f-1,s=t-u,e=0;e<o;e++)r[e]=(n[e+1]<<s|n[e]>>>u)&i;r[o]=n[o]>>>u}function g(n,r,u,f){var o,e;if(u===undefined)u=1;else if(u>=t||u<0)throw new Error("bit count must be smaller than DIGIT_BITS and positive in shiftLeft");for(f===undefined&&(f=n.length),o=t-u,r[f]=n[f-1]>>>t-u||r[f],e=f-1;e>0;e--)r[e]=(n[e]<<u|n[e-1]>>>o)&i;r[0]=n[0]<<u&i}function b(n,r,u){var s=n,o=r,h,f,e;for(r.length<n.length&&(s=r,o=n),h=s.length,f=0,e=0;e<h;e+=1)f+=s[e]+o[e],u[e]=f&i,f=f>>t;for(e=h;e<o.length;e+=1)f+=o[e],u[e]=f&i,f=f>>t;return u.length=o.length,f!==0&&(u[e]=f&i),f}function rt(n,r,u){var o=r.length,e,f;if(n.length<r.length&&(o=c(r)+1,n.length<o))throw new Error("Subtrahend is longer than minuend, not supported.");for(f=0,e=0;e<o;e+=1)f+=n[e]-r[e],u[e]=f&i,f=f>>t;while(e<n.length)f+=n[e],u[e++]=f&i,f=f>>t;return f}function a(n,t,u){for(var s=typeof t=="number"?[t]:t,h=Math.max(n.length,s.length),e,o,f=0;f<h;f+=1)u[f]=0;for(f=0;f<s.
//# sourceMappingURL=msrcrypto.min.js.map