From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-oi0-x22a.google.com (mail-oi0-x22a.google.com [IPv6:2607:f8b0:4003:c06::22a]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 518181A1E00 for ; Wed, 31 Aug 2016 16:27:56 -0700 (PDT) Received: by mail-oi0-x22a.google.com with SMTP id c15so93305497oig.0 for ; Wed, 31 Aug 2016 16:27:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=nqM7RsDq49Z3F1hraNirPlEZzBCMdpg4ErcA+YJ0yHM=; b=x+B7WL/7YUOrbC9KwNGljAN461eSJnXRa76/keu4sF0dabxgg9SOF3YAo9nGU3R1VD j1zwxZ3d8gw38BBitc+R1/rxIadb65g6EfqX/knaP0URcDHP5kv1IZZhZvQUtk6udpo5 N19K7wXXCSKJhCpWYWHlP3lgswmnxlM1PJzuwkRMg1b8xaAE5yIlp7hEnY1hAzQPkezp kajhI9QFOsJo9VhuVBuBuNhBcVxQnn/KELzBWypBT1dHp68cs9ynJKwSK9cnMRJto6fG zDAiDfhNXxQK2s4QTpr4cL/vT96rBtNdNyZyofL0gopokDH9OwtKbeJF1HGHUMHuLJXo 0PnQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=nqM7RsDq49Z3F1hraNirPlEZzBCMdpg4ErcA+YJ0yHM=; b=BQXRcoqTUtiW2jVH0FCN3Klih44bpZPjRyqmxr5YKYfyyYD2xkMSkJeKTEbFLWaR+J majKmwNhRdPSfMktPraSOfgLpJSNnvwNP7Xh6gGMrN81x0BDpMjUetsWsfkTyxIX026R o1uvUayA9CsJy/dS4MoSYQLP9xo/sYFJqY8yJUMXJ5iH9SPwYXQwB5R8KSVO/z2nnsTP yoJjeAgib5svGFbn+GmywdjxGehwQI3pn6IjtH3pSFHIn3/kwMVx8bXBg1MCbLmCD3F5 i0qXzdV/888zEENbytEC4pjYp61ZnI2i+ZirgkUi0Ownt77LrBkA1eR15lLbhgOzd0Qj udHg== X-Gm-Message-State: AE9vXwNPAbyDEPAiwaC2wCp0Hk5m5guU4PeMPuoH6QsRaDFfwHWyMeyGHbAR/qkjofmQIpTbIrptX1KB2kuEMQ== X-Received: by 10.157.33.15 with SMTP id i15mr12324026otb.75.1472686075196; Wed, 31 Aug 2016 16:27:55 -0700 (PDT) MIME-Version: 1.0 Received: by 10.202.50.86 with HTTP; Wed, 31 Aug 2016 16:27:54 -0700 (PDT) In-Reply-To: References: <91B24DF7-4F53-4DEF-A600-755A69368B79@apple.com> From: valerij zaporogeci Date: Thu, 1 Sep 2016 02:27:54 +0300 Message-ID: To: edk2-devel Subject: Re: Crc32 X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Aug 2016 23:27:56 -0000 Content-Type: text/plain; charset=UTF-8 >> I was thinking that all the difference in the Tianocore impl. from the >> pure crc is appending 32 1's at the beginning of the (input) message >> and then negating the Crc itself in the end. Thank you, Michael and Andrew for your help. I figured out what causes the difference. Apart from initializing crc with ffffffff at the beginning and negating the resulting crc at the end, the difference is that Tianocore impl. reverses bits in the byte sequence (of the input), thus bit 7 of every byte becomes bit 0 and bit 0 - bit 7. And also in the end, resulting Crc is also reverted bitwise (bit 31->0, 0->31). Not that I understood everything, but applying these inversions into the pure remainder calculation, gives matching with the Tianocore function results.