• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: How is the APFS block checksum calculated?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How is the APFS block checksum calculated?


  • Subject: Re: How is the APFS block checksum calculated?
  • From: Thomas Tempelmann <email@hidden>
  • Date: Sun, 30 Apr 2017 13:47:32 +0200

Nevermind - someone figured it out: https://blog.cugu.eu/post/apfs/#checksum

My code was missing the extra (optional) "check bytes" after the sums calculation.

I've updated my code accordingly: http://files.tempel.org/tmp/apfs-fletcher-test.zip

It now also contains versions for fletcher-16 and -32, as well as an optimized form that avoids the use of the modulo operator (though, with modern desktop CPUs, I wonder if that even still makes a difference or if the MOD instruction is just as fast as an AND and a SHIFT instruction together).

(As Quinn says) Enjoy,
  Thomas



On Sun, Apr 30, 2017 at 1:47 AM, Toby Thain <email@hidden> wrote:
On 2017-04-29 7:42 PM, Thomas Tempelmann wrote:
On Sun, Apr 30, 2017 at 1:37 AM, Toby Thain <email@hidden
<mailto:email@hidden.au>> wrote:

    Seems you have % instead of & ? And watch out for sign extension on
    those literal 0xFFFFFFFF's. You probably want an unsigned and long
    long suffix on them.


Nope, both are correct, at least for standard fletcher algorithm. It's
always modulo (%) MAXINT-1.

Ah, OK. Thanks for clarifying!


> And 0xFFFFFFFF's gets properly expanded to
unsigned 64 bit, as it should. I double checked using uint64_t variable
all the way, and it didn't change the outcome.

--
Thomas Tempelmann, http://www.tempel.org/
Follow me on Twitter: https://twitter.com/tempelorg
Read my programming blog: http://blog.tempel.org/




--
Thomas Tempelmann, http://www.tempel.org/
Follow me on Twitter: https://twitter.com/tempelorg
Read my programming blog: http://blog.tempel.org/
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Filesystem-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: How is the APFS block checksum calculated?
      • From: Grzegorz Antoniak <email@hidden>
References: 
 >How is the APFS block checksum calculated? (From: Thomas Tempelmann <email@hidden>)
 >Re: How is the APFS block checksum calculated? (From: Toby Thain <email@hidden>)
 >Re: How is the APFS block checksum calculated? (From: Thomas Tempelmann <email@hidden>)
 >Re: How is the APFS block checksum calculated? (From: Toby Thain <email@hidden>)

  • Prev by Date: Re: How is the APFS block checksum calculated?
  • Next by Date: Re: How is the APFS block checksum calculated?
  • Previous by thread: Re: How is the APFS block checksum calculated?
  • Next by thread: Re: How is the APFS block checksum calculated?
  • Index(es):
    • Date
    • Thread