SidLength -- Macro to Provide the Length of a SID

The inputs for this algorithm are:

This algorithm returns the size, in bytes, of SID. This is equal to the number of bytes occupied by the Revision, SubAuthorityCount, and IdentifierAuthorityCount fields of a SID. Added to this is the size of a SubAuthority field of a SID times SID.SubAuthorityCount.

Pseudocode for the algorithm is as follows:

  • SidLength(SID) = (8 + (4 * SID.SubAuthorityCount))