private long getStreamID(int propertyKind, int nameOffset, ClassID guid, int guidIndex, Consumer<String> propertyNameSetter, Consumer<Long> propertyNameCRC32Setter) {
        if (propertyKind == 0) {
            // numerical named property
            return 0x1000L + (nameOffset ^ (guidIndex << 1)) % 0x1F;
        }

        // string named property
        byte[] stringBytes = stringStream.getValue();
        long propertyNameCRC32 = -1;
        if (stringBytes.length > nameOffset) {
            long nameLength = LittleEndian.getUInt(stringBytes, nameOffset);
            if (stringBytes.length >= nameOffset + 4 + nameLength) {
                int nameStart = nameOffset + 4;
                String propertyName = new String(stringBytes, nameStart, (int) nameLength, StringUtil.UTF16LE);
                if (PropertySetType.PS_INTERNET_HEADERS.classID.equals(guid)) {
                    byte[] n = propertyName
                            .toLowerCase(Locale.ROOT)
                            .getBytes(StringUtil.UTF16LE);
                    propertyNameCRC32 = calculateCRC32(n, 0, n.length);
                } else {
                    propertyNameCRC32 = calculateCRC32(stringBytes, nameStart, (int) nameLength);
                }
                propertyNameSetter.accept(propertyName);
                propertyNameCRC32Setter.accept(propertyNameCRC32);
            }
        }
        return 0x1000 + (propertyNameCRC32 ^ ((guidIndex << 1) | 1)) % 0x1F;
    }
Get property tag id by property set GUID and string name or numerical name from named properties mapping

@param guid Property set GUID in registry format without brackets.
            May be one of the PS_* or PSETID_* constants
@param name Property name in case of string named property
@param id   Property id in case of numerical named property
@return Property tag which can be matched with {@link MAPIProperty#id}
or 0 if the property could not be found.
tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-microsoft-module/src/main/java/org/apache/tika/parser/microsoft/msg/TikaNameIdChunks.java