public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Michael Brown" <mcb30@ipxe.org>
To: devel@edk2.groups.io, wenzhao1.li@intel.com
Cc: Bob Feng <bob.c.feng@intel.com>,
	Liming Gao <gaoliming@byosoft.com.cn>,
	Yuwei Chen <yuwei.chen@intel.com>
Subject: Re: [edk2-devel] [PATCH] [edk2-basetools]GenCrc32:Convert the C tool of calculating the crc32 into a python tool
Date: Thu, 1 Sep 2022 11:54:30 +0100	[thread overview]
Message-ID: <815399fe-36e9-2365-470c-d25b60a08494@ipxe.org> (raw)
In-Reply-To: <20220901065702.2412-1-wenzhao1.li@intel.com>

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

      reply	other threads:[~2022-09-01 10:54 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-01  6:57 [PATCH] [edk2-basetools]GenCrc32:Convert the C tool of calculating the crc32 into a python tool liwenzha
2022-09-01 10:54 ` Michael Brown [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=815399fe-36e9-2365-470c-d25b60a08494@ipxe.org \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox