/var/www/greso.tech/server/nsm/node_modules/qrcode/lib/core
NameSizeModeActions
alignment-pattern.js29960644editdlrm
alphanumeric-data.js18220644editdlrm
bit-buffer.js7190644editdlrm
bit-matrix.js15010644editdlrm
byte-data.js6850644editdlrm
error-correction-code.js34150755editdlrm
error-correction-level.js8930644editdlrm
finder-pattern.js5990644editdlrm
format-info.js11260644editdlrm
galois-field.js18990644editdlrm
kanji-data.js15840644editdlrm
mask-pattern.js61010644editdlrm
mode.js39830644editdlrm
numeric-data.js12110644editdlrm
polynomial.js15890644editdlrm
qrcode.js151280644editdlrm
reed-solomon-encoder.js16250644editdlrm
regex.js10840644editdlrm
segments.js93310644editdlrm
utils.js16210644editdlrm
version-check.js2680644editdlrm
version.js49280755editdlrm
Edit: /var/www/greso.tech/server/nsm/node_modules/qrcode/lib/core/reed-solomon-encoder.js (1625B)
const Polynomial = require('./polynomial') function ReedSolomonEncoder (degree) { this.genPoly = undefined this.degree = degree if (this.degree) this.initialize(this.degree) } /** * Initialize the encoder. * The input param should correspond to the number of error correction codewords. * * @param {Number} degree */ ReedSolomonEncoder.prototype.initialize = function initialize (degree) { // create an irreducible generator polynomial this.degree = degree this.genPoly = Polynomial.generateECPolynomial(this.degree) } /** * Encodes a chunk of data * * @param {Uint8Array} data Buffer containing input data * @return {Uint8Array} Buffer containing encoded data */ ReedSolomonEncoder.prototype.encode = function encode (data) { if (!this.genPoly) { throw new Error('Encoder not initialized') } // Calculate EC for this data block // extends data size to data+genPoly size const paddedData = new Uint8Array(data.length + this.degree) paddedData.set(data) // The error correction codewords are the remainder after dividing the data codewords // by a generator polynomial const remainder = Polynomial.mod(paddedData, this.genPoly) // return EC data blocks (last n byte, where n is the degree of genPoly) // If coefficients number in remainder are less than genPoly degree, // pad with 0s to the left to reach the needed number of coefficients const start = this.degree - remainder.length if (start > 0) { const buff = new Uint8Array(this.degree) buff.set(remainder, start) return buff } return remainder } module.exports = ReedSolomonEncoder