FRDU:PrincipalIdToFriendCode

FRDU:PrincipalIdToFriendCode

Request #

WordDescription
0
0x00240040Cmd0x0024Param1Xlat0
1Principal ID

Response #

WordDescription
0
0x002400C0Cmd0x0024Param3Xlat0
1Result code
2-3u64, Friend code

Description #

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