Apnea Board Forum - CPAP | Sleep Apnea
Resmed CRC algorithm? - Printable Version

+- Apnea Board Forum - CPAP | Sleep Apnea (https://www.apneaboard.com/forums)
+-- Forum: Public Area (https://www.apneaboard.com/forums/Forum-Public-Area)
+--- Forum: Software Support Forum (https://www.apneaboard.com/forums/Forum-Software-Support-Forum)
+--- Thread: Resmed CRC algorithm? (/Thread-Resmed-CRC-algorithm)



Resmed CRC algorithm? - wayward - 09-12-2019

Out of curiosity, does anyone know what algorithm is used to generate the 64-bit CRC checksum files used for the EDF data on the S10 machines?  I ran RevEng against the 32-bit checksums for the TGT files and that turned out to be a pretty standard one.  But RevEng didn't find anything for the 64-bit checksums, and I got nosy.  Thanks!


RE: Resmed CRC algorithm? - pholynyk - 09-13-2019

Philip Koopman of Carnegie-Mellon has several web pages on CRC algorithms that may be useful: https://users.ece.cmu.edu/~koopman/crc/

I haven't looked into using the crc just yet. I did notice that each data record in an edf file has a crc16. It might be useful to crc check the identification.tgt as general check against a corrupt SD card, so I would be happy to have the crc32 polynomial that you discovered.

I hesitate to consider checking every edf file's crc64 because they are big, and there are a lot of them. It would be useful to check the STR.edf file because almost everything depends on it it, bur the STR.crc file was removed from the ten series machines.


RE: Resmed CRC algorithm? - wayward - 09-14-2019

No problem.  The values I got for the 32-bit checksums are below.  (Though the polynomials may be standard for CRC-32/ISO-HDLC.  "Refin" and "refout" refer to reflecting the input and output values.

width=32  
poly=0x04c11db7  
init=0xffffffff  
refin=true  
refout=true  
xorout=0xffffffff  
check=0xcbf43926  
residue=0xdebb20e3  
name="CRC-32/ISO-HDLC"


RE: Resmed CRC algorithm? - wayward - 09-14-2019

FWIW, there was an interesting post here: http://www. a DME-owned forum .com/viewtopic/t93676/Data--Settings-on-ResMed-S9-Escape.html

"They might just be seeding the CRC start value or using a non standard root polynomial.. which doesn't take long to hack out on a modern computer.
It could also be in a different byte order depending on the devices CPU.

Could also be stringing together 2 phases of a CRC32 variant or similar, which is quite possible considering there is both 4 and 8 byte crc's.. (a fairly common practice when firmware space is limited)"


RE: Resmed CRC algorithm? - pholynyk - 09-14-2019

Thank you, Wayward, I will incorporate that into the resmed importer.