mirror of
https://github.com/pezkuwichain/pezkuwi-mobile-app.git
synced 2026-05-30 11:11:01 +00:00
1 line
5.7 KiB
Plaintext
1 line
5.7 KiB
Plaintext
{"dependencies":[{"name":"./polynomial","data":{"asyncType":null,"isESMImport":false,"locs":[{"start":{"line":1,"column":19,"index":19},"end":{"line":1,"column":42,"index":42}}],"key":"MjZY/rEGZsczUXN0UsBvSLfXv8w=","exportNames":["*"],"imports":1}}],"output":[{"data":{"code":"__d(function (global, require, _$$_IMPORT_DEFAULT, _$$_IMPORT_ALL, module, exports, _dependencyMap) {\n const Polynomial = require(_dependencyMap[0], \"./polynomial\");\n function ReedSolomonEncoder(degree) {\n this.genPoly = undefined;\n this.degree = degree;\n if (this.degree) this.initialize(this.degree);\n }\n\n /**\n * Initialize the encoder.\n * The input param should correspond to the number of error correction codewords.\n *\n * @param {Number} degree\n */\n ReedSolomonEncoder.prototype.initialize = function initialize(degree) {\n // create an irreducible generator polynomial\n this.degree = degree;\n this.genPoly = Polynomial.generateECPolynomial(this.degree);\n };\n\n /**\n * Encodes a chunk of data\n *\n * @param {Uint8Array} data Buffer containing input data\n * @return {Uint8Array} Buffer containing encoded data\n */\n ReedSolomonEncoder.prototype.encode = function encode(data) {\n if (!this.genPoly) {\n throw new Error('Encoder not initialized');\n }\n\n // Calculate EC for this data block\n // extends data size to data+genPoly size\n const paddedData = new Uint8Array(data.length + this.degree);\n paddedData.set(data);\n\n // The error correction codewords are the remainder after dividing the data codewords\n // by a generator polynomial\n const remainder = Polynomial.mod(paddedData, this.genPoly);\n\n // return EC data blocks (last n byte, where n is the degree of genPoly)\n // If coefficients number in remainder are less than genPoly degree,\n // pad with 0s to the left to reach the needed number of coefficients\n const start = this.degree - remainder.length;\n if (start > 0) {\n const buff = new Uint8Array(this.degree);\n buff.set(remainder, start);\n return buff;\n }\n return remainder;\n };\n module.exports = ReedSolomonEncoder;\n});","lineCount":53,"map":[[2,2,1,0],[2,8,1,6,"Polynomial"],[2,18,1,16],[2,21,1,19,"require"],[2,28,1,26],[2,29,1,26,"_dependencyMap"],[2,43,1,26],[2,62,1,41],[2,63,1,42],[3,2,3,0],[3,11,3,9,"ReedSolomonEncoder"],[3,29,3,27,"ReedSolomonEncoder"],[3,30,3,29,"degree"],[3,36,3,35],[3,38,3,37],[4,4,4,2],[4,8,4,6],[4,9,4,7,"genPoly"],[4,16,4,14],[4,19,4,17,"undefined"],[4,28,4,26],[5,4,5,2],[5,8,5,6],[5,9,5,7,"degree"],[5,15,5,13],[5,18,5,16,"degree"],[5,24,5,22],[6,4,7,2],[6,8,7,6],[6,12,7,10],[6,13,7,11,"degree"],[6,19,7,17],[6,21,7,19],[6,25,7,23],[6,26,7,24,"initialize"],[6,36,7,34],[6,37,7,35],[6,41,7,39],[6,42,7,40,"degree"],[6,48,7,46],[6,49,7,47],[7,2,8,0],[9,2,10,0],[10,0,11,0],[11,0,12,0],[12,0,13,0],[13,0,14,0],[14,0,15,0],[15,2,16,0,"ReedSolomonEncoder"],[15,20,16,18],[15,21,16,19,"prototype"],[15,30,16,28],[15,31,16,29,"initialize"],[15,41,16,39],[15,44,16,42],[15,53,16,51,"initialize"],[15,63,16,61,"initialize"],[15,64,16,63,"degree"],[15,70,16,69],[15,72,16,71],[16,4,17,2],[17,4,18,2],[17,8,18,6],[17,9,18,7,"degree"],[17,15,18,13],[17,18,18,16,"degree"],[17,24,18,22],[18,4,19,2],[18,8,19,6],[18,9,19,7,"genPoly"],[18,16,19,14],[18,19,19,17,"Polynomial"],[18,29,19,27],[18,30,19,28,"generateECPolynomial"],[18,50,19,48],[18,51,19,49],[18,55,19,53],[18,56,19,54,"degree"],[18,62,19,60],[18,63,19,61],[19,2,20,0],[19,3,20,1],[21,2,22,0],[22,0,23,0],[23,0,24,0],[24,0,25,0],[25,0,26,0],[26,0,27,0],[27,2,28,0,"ReedSolomonEncoder"],[27,20,28,18],[27,21,28,19,"prototype"],[27,30,28,28],[27,31,28,29,"encode"],[27,37,28,35],[27,40,28,38],[27,49,28,47,"encode"],[27,55,28,53,"encode"],[27,56,28,55,"data"],[27,60,28,59],[27,62,28,61],[28,4,29,2],[28,8,29,6],[28,9,29,7],[28,13,29,11],[28,14,29,12,"genPoly"],[28,21,29,19],[28,23,29,21],[29,6,30,4],[29,12,30,10],[29,16,30,14,"Error"],[29,21,30,19],[29,22,30,20],[29,47,30,45],[29,48,30,46],[30,4,31,2],[32,4,33,2],[33,4,34,2],[34,4,35,2],[34,10,35,8,"paddedData"],[34,20,35,18],[34,23,35,21],[34,27,35,25,"Uint8Array"],[34,37,35,35],[34,38,35,36,"data"],[34,42,35,40],[34,43,35,41,"length"],[34,49,35,47],[34,52,35,50],[34,56,35,54],[34,57,35,55,"degree"],[34,63,35,61],[34,64,35,62],[35,4,36,2,"paddedData"],[35,14,36,12],[35,15,36,13,"set"],[35,18,36,16],[35,19,36,17,"data"],[35,23,36,21],[35,24,36,22],[37,4,38,2],[38,4,39,2],[39,4,40,2],[39,10,40,8,"remainder"],[39,19,40,17],[39,22,40,20,"Polynomial"],[39,32,40,30],[39,33,40,31,"mod"],[39,36,40,34],[39,37,40,35,"paddedData"],[39,47,40,45],[39,49,40,47],[39,53,40,51],[39,54,40,52,"genPoly"],[39,61,40,59],[39,62,40,60],[41,4,42,2],[42,4,43,2],[43,4,44,2],[44,4,45,2],[44,10,45,8,"start"],[44,15,45,13],[44,18,45,16],[44,22,45,20],[44,23,45,21,"degree"],[44,29,45,27],[44,32,45,30,"remainder"],[44,41,45,39],[44,42,45,40,"length"],[44,48,45,46],[45,4,46,2],[45,8,46,6,"start"],[45,13,46,11],[45,16,46,14],[45,17,46,15],[45,19,46,17],[46,6,47,4],[46,12,47,10,"buff"],[46,16,47,14],[46,19,47,17],[46,23,47,21,"Uint8Array"],[46,33,47,31],[46,34,47,32],[46,38,47,36],[46,39,47,37,"degree"],[46,45,47,43],[46,46,47,44],[47,6,48,4,"buff"],[47,10,48,8],[47,11,48,9,"set"],[47,14,48,12],[47,15,48,13,"remainder"],[47,24,48,22],[47,26,48,24,"start"],[47,31,48,29],[47,32,48,30],[48,6,50,4],[48,13,50,11,"buff"],[48,17,50,15],[49,4,51,2],[50,4,53,2],[50,11,53,9,"remainder"],[50,20,53,18],[51,2,54,0],[51,3,54,1],[52,2,56,0,"module"],[52,8,56,6],[52,9,56,7,"exports"],[52,16,56,14],[52,19,56,17,"ReedSolomonEncoder"],[52,37,56,35],[53,0,56,35],[53,3]],"functionMap":{"names":["<global>","ReedSolomonEncoder","initialize","encode"],"mappings":"AAA;ACE;CDK;0CEQ;CFI;sCGQ;CH0B"},"hasCjsExports":true},"type":"js/module"}]} |