-1

I have a .zip file inside the project and I am transferring it to the external ESP32 via Bluetooth. But I need to send the CRC-32 checksum at the end of the sending file. I don't have any idea how to generate it.

Can anyone help me with how to do it in the right way?

Thanks in advance.

RushDroid
  • 1,570
  • 3
  • 21
  • 46

1 Answers1

2

So, I have found one amazing framework called CryptoSwift. This made my day. Here is how

  • Get file Data from the file path.

I have a function which returns Data from file name and type. And CryptoSwift has the extension of Data which converts the crc32 by calling simply .crc32()

and than call crc32()

let crcChecksum = Utils.sharedInstance.getFileData(forResource: "firmware", withExtension: "bin").crc32()

For mote detail.

https://github.com/krzyzanowskim/CryptoSwift

RushDroid
  • 1,570
  • 3
  • 21
  • 46