From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-oi0-x233.google.com (mail-oi0-x233.google.com [IPv6:2607:f8b0:4003:c06::233]) (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 61BB71A1E01 for ; Tue, 30 Aug 2016 06:32:23 -0700 (PDT) Received: by mail-oi0-x233.google.com with SMTP id f189so25556618oig.3 for ; Tue, 30 Aug 2016 06:32:23 -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 :cc; bh=cp7O20tymsUB2X+aH8MxRwWJWo3yg5EH9DT/vI9xVQ8=; b=okRPjAIGjCzjUr829RQBnMNJyw98koK7S9B6vLx1OjQYDSVgTFz5YzcwS8Xd2zGa8Z y5uiaVeYY0nc25qNFCdUCIlGZMUdJDRawHS/cy7L1qY8Hcek1cuFi0KcoVa3CzQ4Gq4i 4HpclUx8mKFRVcJcutelKdSqcBB9akhVeSerKV53HbiPPcVktmh191WWS2n7a3YWlSEY o3Mt5HPzHBq5KnTY8h9qCPSwqGMV5Dl+cVmGS8Ln3CvHBVh7Te9ahyGl3fp/hIq4jXw3 UK/AnLcu3QD/yR1himtwvI35hE5TtFa7/ZZToImsBcanSXwac8B7vtPL/sxdBeze0bit SURg== 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:cc; bh=cp7O20tymsUB2X+aH8MxRwWJWo3yg5EH9DT/vI9xVQ8=; b=Kuh4ZBzQnuq7clR8RiOAuR1Ha0KXBch8mPdInGKj5cG+Jt1SWAr2yjWnwGM0zUr4Nk jFa75ij+KrW7t3vtlHz3ahYU1PvytcpPEM3yvLgRpPg/IBkkw5U0kvutEPaEl33bWUUJ MLnBUkVh5YNDl7H+8YtmFQkM62UYWks7R7gBcfpOsL200NPH+zf7rrqVe79PpQ3DNHUt LFSx5Q+4qlSgJs24MJ8HmvxBYWmLCxH0HvDmxIBaU0DkWCVKcHPLMsswd1sikw3s7LfW Swy+JV9zhXd1PS+qG1IydA2vFVBUniNOxEnXULIcYtSUqwQjx9kSOM44MMTg90g/LhAN BRfg== X-Gm-Message-State: AE9vXwMHxNUYX2OpwHJCNjOMui2ihcA7euAI/IIfRdLz8KVWutFKQ5HqdHnCIgQigQUlCfUB2zYt3wT3p1EDPg== X-Received: by 10.202.4.149 with SMTP id 143mr3604064oie.91.1472563940056; Tue, 30 Aug 2016 06:32:20 -0700 (PDT) MIME-Version: 1.0 Received: by 10.202.50.86 with HTTP; Tue, 30 Aug 2016 06:32:19 -0700 (PDT) In-Reply-To: References: From: valerij zaporogeci Date: Tue, 30 Aug 2016 16:32:19 +0300 Message-ID: To: Michael Zimmermann Cc: 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: Tue, 30 Aug 2016 13:32:23 -0000 Content-Type: text/plain; charset=UTF-8 Thank you. But the polynomial value for CCITT crc32 is 104c11db7, not its tail 04c11db7. And this whole mess with all those online calculators was the exact reson I asked here. Because they mostly give WRONG result. As your example. It's easy to check it's wrong. Because for example leading zeroes in the message MUST not change the Crc32. Here we have: for 01 -> CD39D477 for 00 01 -> D71E16AC and so on. Also, it's obvious that Crc32(1) would be a polynomial without the most significant non-zero bit, thus crc32 from 1 by the polynomial 104c11db7 would be 04c11b7. The only online calculator so far giving right results is here: https://ghsi.de/CRC/index.php?Polynom=100000100110000010001110110110111&Message=0104c11db7 I wrote function following the mathematics of the Crc and it gives results exactly like in the above calculator. It's fun to imagine what happens with such an incompatibilty for example in case of GPT header. 2016-08-30 14:08 GMT+03:00, Michael Zimmermann : > well as u already said, the spec says it uses 'a standard CCITT32 CRC > algorithm with a seed polynomial value of 0x04c11db7' > > this is the implementation which confirms it: > https://github.com/tianocore/edk2/blob/master/MdeModulePkg/Core/RuntimeDxe/Crc32.c > > after testing it it indeed produces CCITT32 results like this online > generator: > http://g6auc.me.uk/CRC32/index.html > > Thanks > Michael > > On Tue, Aug 30, 2016 at 2:54 AM, valerij zaporogeci > wrote: > >> Hi, all. >> Yet another dumb question from me. >> UEFI specification has Crc32 calculation service and uses Crc32 in >> several places. but it only humbly mentions in the note somewhere in >> the description of System Table about what exact one it wants. Namely >> it states that the polynomial seed is 04c11db7. And that's all. >> My question is - does really the specification means the 33-bit >> polynomial >> 104c11db7? And is the algorithm just a plain remainder calculation >> without any additional pre/post processing of it? So that for example >> Crc32 of the 4-byte sequence b16b00b5 would be >> 8c1f0a7c? >> Thank you. >> _______________________________________________ >> edk2-devel mailing list >> edk2-devel@lists.01.org >> https://lists.01.org/mailman/listinfo/edk2-devel >> >