FRDU:PrincipalIdToFriendCode
Revision as of 17:49, 14 December 2024 by TimmSkiller (talk | contribs)
Request[edit]
Index Word | Description | ||||||||
---|---|---|---|---|---|---|---|---|---|
0 |
| ||||||||
1 | Principal ID |
Response[edit]
Index Word | Description | ||||||||
---|---|---|---|---|---|---|---|---|---|
0 |
| ||||||||
1 | Result code | ||||||||
2-3 | u64, Friend code |
Description[edit]
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