On 01/09/2022 07:57, liwenzha wrote:
This patch converts the C tool of calculating the crc32 value of file into
a python file. To realize this,after reading the data into the file in
binary form from an original file,a lookup table is listed to do XOR and
shifting calculation for each bit in the file.

Python has binascii.crc32 as part of the standard library. You can throw away the mCrcTable and all of the open-coded CRC32 calculation logic, and just do:

  from binascii import crc32

  CrcOut = crc32(filebytes)

HTH,

Michael


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#93039): https://edk2.groups.io/g/devel/message/93039
Mute This Topic: https://groups.io/mt/93391061/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-


Reply via email to