Difference between revisions of "FRDU:PrincipalIdToFriendCode"
Jump to navigation
Jump to search
(Created page with "=Request= {| class="wikitable" border="1" |- ! Index Word ! Description |- | 0 | Header code [0x00240040] |- | 1 | principalId |} This function takes the principalId given...") |
TimmSkiller (talk | contribs) |
||
Line 1: | Line 1: | ||
=Request= | =Request= | ||
− | { | + | {{IPC/Request}} |
− | | | + | {{IPC/RequestHeader|0x0024|1|0}} |
− | + | {{IPC/RequestEntry|Principal ID}} | |
− | + | {{IPC/RequestEnd}} | |
− | | | ||
− | | 0 | ||
− | | | ||
− | |||
− | |||
− | |||
− | |||
− | + | =Response= | |
+ | {{IPC/Request}} | ||
+ | {{#vardefine:ipc_offset|0}} | ||
+ | {{IPC/RequestHeader|0x0024|3|0}} | ||
+ | {{IPC/RequestEntry|Result code}} | ||
+ | {{IPC/RequestEntryRange|2|u64, Friend code}} | ||
+ | {{IPC/RequestEnd}} | ||
− | + | =Description= | |
+ | Converts the given Principal ID to a Friend Code. The following algorithm is used (note: everything is in little endian): | ||
− | + | <code> | |
− | + | principal_id_buf = principal_id as LE bytes | |
− | + | ||
− | + | friend_code = ((sha1(principal_id_buf)[0] >> 1) << 32) | principal_id | |
− | + | </code> | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | | | ||
− | |||
− | |||
− |
Latest revision as of 17:49, 14 December 2024
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