How to use crc.crc16:
244 245 246 247 248 249 250 251 252 253 254 255
this.objects = this.parseObjects(match[2]); }; Telegram.prototype.checksum = function() { var data = this.telegram.match(patterns.CHECKSUM)[1]; return ('0000' + crc.crc16(data).toString(16)).slice(-4).toUpperCase(); } Telegram.prototype.parseObjects = function(data) { // Extract objects.
How to use crc.crc16modbus:
141 142 143 144 145 146 147 148 149
let onError = err => this.emit('error', err); let onSend = (pdu, unitId) => { let pkt = Put().word8((unitId === undefined ? this.options.unitId : unitId) || 0).put(pdu); let buf = pkt.buffer(); let crc16 = crc.crc16modbus(buf); pkt = pkt.word16le(crc16).buffer(); connect();
25
38
0
See more examples
How to use crc.crc16xmodem:
GitHub: exsilium/xmodem.js
368 369 370 371 372 373 374 375 376 377
blockData ]); log.info('SENDBLOCK! Data length: ' + blockData.length); log.info(sendBuffer); if(mode === 'crc') { var crcString = crc.crc16xmodem(blockData).toString(16); // Need to avoid odd string for Buffer creation if(crcString.length % 2 == 1) { crcString = '0'.concat(crcString); }
How to use crc.crc16ccitt:
46 47 48 49 50 51 52 53 54 55
payload.push(genEMV('61', cep)); } payload.push(genEMV('62', genEMV('05', transactionId))); payload.push('6304'); const stringPayload = payload.join(''); const crcResult = crc_1.crc16ccitt(stringPayload).toString(16).toUpperCase().padStart(4, '0'); const payloadPIX = `${stringPayload}${crcResult}`; return { payload: () => payloadPIX, base64: (options) => qrcode_1.default.toDataURL(payloadPIX, options),
25
157
0
See more examples
How to use crc.crc32:
7366 7367 7368 7369 7370 7371 7372 7373 7374 7375 7376 7377
if (typeof (validCrc) != 'number') { return false; } // get crc of the payload var crc = CRC.crc32(tagged); return crc == validCrc; }
334
101
2
See more examples
How to use crc.crcjam:
1185 1186 1187 1188 1189 1190 1191 1192 1193 1194
outOffset += data.length; } var crcVal = 0xffffffff; crcVal = crc.crcjam(typeSignature, crcVal); crcVal = crc.crcjam(data, crcVal); // CRC outBuff.writeInt32BE(crcVal ^ 0xffffffff, outOffset);