1 // Generated by CoffeeScript 1.7.1
4 hex = require('./hex');
6 module.exports = CRC = (function() {
7 CRC.prototype.INIT_CRC = 0x00;
9 CRC.prototype.XOR_MASK = 0x00;
11 CRC.prototype.WIDTH = 0;
13 CRC.prototype.pack = function(crc) {
17 CRC.prototype.each_byte = function(buf, cb) {
18 var i, _i, _ref, _results;
19 if (!Buffer.isBuffer(buf)) {
23 for (i = _i = 0, _ref = buf.length - 1; 0 <= _ref ? _i <= _ref : _i >= _ref; i = 0 <= _ref ? ++_i : --_i) {
24 _results.push(cb(buf[i]));
30 this.crc = this.INIT_CRC;
33 CRC.prototype.digest_length = function() {
34 return Math.ceil(this.WIDTH / 8.0);
37 CRC.prototype.update = function(data) {};
39 CRC.prototype.reset = function() {
40 return this.crc = this.INIT_CRC;
43 CRC.prototype.checksum = function(signed) {
48 sum = this.crc ^ this.XOR_MASK;
55 CRC.prototype.finish = function() {
56 return this.pack(this.checksum());
59 CRC.prototype.hexdigest = function(value) {
64 result = this.finish();