You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

108 lines
4.4 KiB

1 year ago
  1. module.exports = (function() {
  2. var __MODS__ = {};
  3. var __DEFINE__ = function(modId, func, req) { var m = { exports: {}, _tempexports: {} }; __MODS__[modId] = { status: 0, func: func, req: req, m: m }; };
  4. var __REQUIRE__ = function(modId, source) { if(!__MODS__[modId]) return require(source); if(!__MODS__[modId].status) { var m = __MODS__[modId].m; m._exports = m._tempexports; var desp = Object.getOwnPropertyDescriptor(m, "exports"); if (desp && desp.configurable) Object.defineProperty(m, "exports", { set: function (val) { if(typeof val === "object" && val !== m._exports) { m._exports.__proto__ = val.__proto__; Object.keys(val).forEach(function (k) { m._exports[k] = val[k]; }); } m._tempexports = val }, get: function () { return m._tempexports; } }); __MODS__[modId].status = 1; __MODS__[modId].func(__MODS__[modId].req, m, m.exports); } return __MODS__[modId].m.exports; };
  5. var __REQUIRE_WILDCARD__ = function(obj) { if(obj && obj.__esModule) { return obj; } else { var newObj = {}; if(obj != null) { for(var k in obj) { if (Object.prototype.hasOwnProperty.call(obj, k)) newObj[k] = obj[k]; } } newObj.default = obj; return newObj; } };
  6. var __REQUIRE_DEFAULT__ = function(obj) { return obj && obj.__esModule ? obj.default : obj; };
  7. __DEFINE__(1679542505536, function(require, module, exports) {
  8. (function() {
  9. var base64map
  10. = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/',
  11. crypt = {
  12. // Bit-wise rotation left
  13. rotl: function(n, b) {
  14. return (n << b) | (n >>> (32 - b));
  15. },
  16. // Bit-wise rotation right
  17. rotr: function(n, b) {
  18. return (n << (32 - b)) | (n >>> b);
  19. },
  20. // Swap big-endian to little-endian and vice versa
  21. endian: function(n) {
  22. // If number given, swap endian
  23. if (n.constructor == Number) {
  24. return crypt.rotl(n, 8) & 0x00FF00FF | crypt.rotl(n, 24) & 0xFF00FF00;
  25. }
  26. // Else, assume array and swap all items
  27. for (var i = 0; i < n.length; i++)
  28. n[i] = crypt.endian(n[i]);
  29. return n;
  30. },
  31. // Generate an array of any length of random bytes
  32. randomBytes: function(n) {
  33. for (var bytes = []; n > 0; n--)
  34. bytes.push(Math.floor(Math.random() * 256));
  35. return bytes;
  36. },
  37. // Convert a byte array to big-endian 32-bit words
  38. bytesToWords: function(bytes) {
  39. for (var words = [], i = 0, b = 0; i < bytes.length; i++, b += 8)
  40. words[b >>> 5] |= bytes[i] << (24 - b % 32);
  41. return words;
  42. },
  43. // Convert big-endian 32-bit words to a byte array
  44. wordsToBytes: function(words) {
  45. for (var bytes = [], b = 0; b < words.length * 32; b += 8)
  46. bytes.push((words[b >>> 5] >>> (24 - b % 32)) & 0xFF);
  47. return bytes;
  48. },
  49. // Convert a byte array to a hex string
  50. bytesToHex: function(bytes) {
  51. for (var hex = [], i = 0; i < bytes.length; i++) {
  52. hex.push((bytes[i] >>> 4).toString(16));
  53. hex.push((bytes[i] & 0xF).toString(16));
  54. }
  55. return hex.join('');
  56. },
  57. // Convert a hex string to a byte array
  58. hexToBytes: function(hex) {
  59. for (var bytes = [], c = 0; c < hex.length; c += 2)
  60. bytes.push(parseInt(hex.substr(c, 2), 16));
  61. return bytes;
  62. },
  63. // Convert a byte array to a base-64 string
  64. bytesToBase64: function(bytes) {
  65. for (var base64 = [], i = 0; i < bytes.length; i += 3) {
  66. var triplet = (bytes[i] << 16) | (bytes[i + 1] << 8) | bytes[i + 2];
  67. for (var j = 0; j < 4; j++)
  68. if (i * 8 + j * 6 <= bytes.length * 8)
  69. base64.push(base64map.charAt((triplet >>> 6 * (3 - j)) & 0x3F));
  70. else
  71. base64.push('=');
  72. }
  73. return base64.join('');
  74. },
  75. // Convert a base-64 string to a byte array
  76. base64ToBytes: function(base64) {
  77. // Remove non-base-64 characters
  78. base64 = base64.replace(/[^A-Z0-9+\/]/ig, '');
  79. for (var bytes = [], i = 0, imod4 = 0; i < base64.length;
  80. imod4 = ++i % 4) {
  81. if (imod4 == 0) continue;
  82. bytes.push(((base64map.indexOf(base64.charAt(i - 1))
  83. & (Math.pow(2, -2 * imod4 + 8) - 1)) << (imod4 * 2))
  84. | (base64map.indexOf(base64.charAt(i)) >>> (6 - imod4 * 2)));
  85. }
  86. return bytes;
  87. }
  88. };
  89. module.exports = crypt;
  90. })();
  91. }, function(modId) {var map = {}; return __REQUIRE__(map[modId], modId); })
  92. return __REQUIRE__(1679542505536);
  93. })()
  94. //miniprogram-npm-outsideDeps=[]
  95. //# sourceMappingURL=index.js.map