FRDU:PrincipalIdToFriendCode
Revision as of 17:49, 14 December 2024 by TimmSkiller (talk | contribs)
RequestEdit
Index Word | Description | ||||||||
---|---|---|---|---|---|---|---|---|---|
0 |
| ||||||||
1 | Principal ID |
ResponseEdit
Index Word | Description | ||||||||
---|---|---|---|---|---|---|---|---|---|
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