app/GedcomTag.php
public static function createUid(): string
    {
        $uid = str_replace('-', '', Uuid::uuid4()->toString());

        $checksum_a = 0; // a sum of the bytes
        $checksum_b = 0; // a sum of the incremental values of $checksum_a

        // Compute checksums
        for ($i = 0; $i < 32; $i += 2) {
            $checksum_a += hexdec(substr($uid, $i, 2));
            $checksum_b += $checksum_a & 0xff;
        }

        return strtoupper($uid . substr(dechex($checksum_a), -2) . substr(dechex($checksum_b), -2));
    }
public static function createUid(): string
    {
        $uid = str_replace('-', '', Uuid::uuid4()->toString());

        $checksum_a = 0; // a sum of the bytes
        $checksum_b = 0; // a sum of the incremental values of $checksum_a

        // Compute checksums
        for ($i = 0; $i < 32; $i += 2) {
            $checksum_a += hexdec(substr($uid, $i, 2));
            $checksum_b += $checksum_a & 0xff;
        }

        return strtoupper($uid . substr(dechex($checksum_a), -2) . substr(dechex($checksum_b), -2));
    }
public static function createUid ( ) : string { $ uid = str_replace ( '-' , '' , Uuid :: uuid4 ( ) -> toString ( ) ) ; $ checksum_a = 0 ; // a sum of the bytes $ checksum_b = 0 ; // a sum of the incremental values of $checksum_a // Compute checksums for ( $ i = 0 ; $ i < 32 ; $ i += 2 ) { $ checksum_a += hexdec ( substr ( $ uid , $ i , 2 ) ) ; $ checksum_b += $ checksum_a & 0xff ; } return strtoupper ( $ uid . substr ( dechex ( $ checksum_a ) , - 2 ) . substr ( dechex ( $ checksum_b ) , - 2 ) ) ; }
Generate a value for a new _UID field.
Instead of RFC4122-compatible UUIDs, generate ones that
are compatible with PAF, Legacy, RootsMagic, etc.
In these, the string is upper-cased, dashes are removed,
and a two-byte checksum is added.

@return string
Generate a value for a new _UID field . Instead of RFC4122 - compatible UUIDs generate ones that are compatible with PAF Legacy RootsMagic etc . In these the string is upper - cased dashes are removed and a two - byte checksum is added .