FRDU:PrincipalIdToFriendCode

Revision as of 17:49, 14 December 2024 by TimmSkiller (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

RequestEdit

Index Word Description
0
Header 0x00240040 Cmd 0x0024 Param 1 Xlat 0
1 Principal ID

ResponseEdit

Index Word Description
0
Header 0x002400C0 Cmd 0x0024 Param 3 Xlat 0
1 Result code
2-3 u64, Friend code

DescriptionEdit

Converts the given Principal ID to a Friend Code. The following algorithm is used (note: everything is in little endian):

principal_id_buf = principal_id as LE bytes

friend_code = ((sha1(principal_id_buf)[0] >> 1) << 32) | principal_id