<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://www.3dbrew.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Cyuubi</id>
	<title>3dbrew - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://www.3dbrew.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Cyuubi"/>
	<link rel="alternate" type="text/html" href="https://www.3dbrew.org/wiki/Special:Contributions/Cyuubi"/>
	<updated>2026-04-16T03:03:23Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.1</generator>
	<entry>
		<id>https://www.3dbrew.org/w/index.php?title=PRUDP&amp;diff=20595</id>
		<title>PRUDP</title>
		<link rel="alternate" type="text/html" href="https://www.3dbrew.org/w/index.php?title=PRUDP&amp;diff=20595"/>
		<updated>2018-02-12T17:22:43Z</updated>

		<summary type="html">&lt;p&gt;Cyuubi: This page isn&amp;#039;t fully documented yet, add a link to more documentation.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;PRUDP&#039;&#039;&#039; is a third-party network protocol used for network communications by some Nintendo software on the 3DS.  It presumably stands for &amp;quot;pretty reliable UDP&amp;quot; or &amp;quot;partially reliable UDP&amp;quot; or some such, and essentially implements TCP-like reliability via sequence numbers and acknowledgement within UDP.  Optionally it also adds security (prudps), via RC4 encryption + hashing. This is the protocol used in Nintendo 3DS and Wii U games for online multiplayer comms etc. This can be used with [[NWM_Services|UDS]] local-WLAN too.&lt;br /&gt;
&lt;br /&gt;
At least two different versions of PRUDP seem to be used by Nintendo software: an older version used in the [[Friend Services|Friend services]] and a newer one used in Pokémon X/Y.&lt;br /&gt;
&lt;br /&gt;
This page isn&#039;t fully documented yet, you can visit [https://github.com/Kinnay/NintendoClients/wiki/PRUDP-Protocol this] for more documentation.&lt;br /&gt;
&lt;br /&gt;
== Version 0 ==&lt;br /&gt;
This is the version of the protocol used by the [[Friend Services|Friend services]].&lt;br /&gt;
&lt;br /&gt;
=== Packet structure ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
 |-&lt;br /&gt;
 !  Type&lt;br /&gt;
 !  Name&lt;br /&gt;
 !  Description&lt;br /&gt;
 |-&lt;br /&gt;
 |  u16&lt;br /&gt;
 |  src_dst&lt;br /&gt;
 |  Magic: client-to-server (afa1) or server-to-client (a1af)&lt;br /&gt;
 |-&lt;br /&gt;
 |  u16&lt;br /&gt;
 |  op&lt;br /&gt;
 |  Type of packet&lt;br /&gt;
 |-&lt;br /&gt;
 |  u8&lt;br /&gt;
 |  unk1&lt;br /&gt;
 |&lt;br /&gt;
 |-&lt;br /&gt;
 |  u32&lt;br /&gt;
 |  unk2&lt;br /&gt;
 |&lt;br /&gt;
 |-&lt;br /&gt;
 |  u16&lt;br /&gt;
 |  seqno&lt;br /&gt;
 |  Incrementing ID to pair up data packets and acknowledgement&lt;br /&gt;
 |-&lt;br /&gt;
 |  u8[*]&lt;br /&gt;
 |  payload&lt;br /&gt;
 |&lt;br /&gt;
 |-&lt;br /&gt;
 |  u8&lt;br /&gt;
 |  checksum&lt;br /&gt;
 |  seems to be related to the sum of the rest of the fields (mod 256)&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
Different kinds of packets have different values for the different fields:&lt;br /&gt;
&lt;br /&gt;
* Handshake (1): op=0x40 or op=0x10 (cli-to-serv or serv-to-cli)&lt;br /&gt;
**  unk1, unk2, seqno are 0&lt;br /&gt;
**  payload: u32 unk3;&lt;br /&gt;
&lt;br /&gt;
* Handshake (2): op=0x61 or op=0x11&lt;br /&gt;
**  unk1, seqno are 0&lt;br /&gt;
**  payload: u32 unk3;&lt;br /&gt;
&lt;br /&gt;
* Hangup: op=0x63 or op=0x13&lt;br /&gt;
&lt;br /&gt;
* Heartbeat: op=0x44 or op=0x14&lt;br /&gt;
**  seqno = increasing&lt;br /&gt;
&lt;br /&gt;
* Data packet: op=0x62&lt;br /&gt;
**  seqno = increasing&lt;br /&gt;
**  payload: u8[?] payload;&lt;br /&gt;
&lt;br /&gt;
* Data ack: op=0x12&lt;br /&gt;
**  unk2  = 0x12345678&lt;br /&gt;
**  seqno = corresponding to the data packet being acknowledged&lt;br /&gt;
&lt;br /&gt;
=== Sample session ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Handshake 1   → af a1 40 00 00 00 00 00 00 00 00 00 00 00 00 97&lt;br /&gt;
Handshake 1   ← a1 af 10 00 00 00 00 00 00 00 00 5f 22 68 ea 3a&lt;br /&gt;
Handshake 2   → af a1 61 00 18 5f 22 68 ea 01 00 d4 d6 91 e8 c9&lt;br /&gt;
Handshake 2   ← a1 af 11 00 50 d4 d6 91 e8 01 00 00 00 00 00 de&lt;br /&gt;
Send data     → af a1 62 00 18 26 b4 01 a1 02 00 00 (25 bytes of encrypted payload) ef&lt;br /&gt;
Acknowledge   ← a1 af 12 00 50 78 56 34 12 02 00 00 d1&lt;br /&gt;
Send data     ← a1 af 62 00 50 67 dd f9 c3 01 00 00 (255 bytes of encrypted payload) 03&lt;br /&gt;
Acknowledge   → af a1 12 00 18 78 56 34 12 01 00 00 97&lt;br /&gt;
Send data     → af a1 62 00 18 8d 58 91 c0 03 00 00 (21 bytes of encrypted payload) fa&lt;br /&gt;
Acknowledge   ← a1 af 12 00 50 78 56 34 12 03 00 00 d2&lt;br /&gt;
Send data     ← a1 af 62 00 50 a9 c5 fa 2e 02 00 00 (130 bytes of encrypted payload) 54&lt;br /&gt;
Acknowledge   → af a1 12 00 18 78 56 34 12 02 00 00 98&lt;br /&gt;
Hangup        → af a1 63 00 18 5f 22 68 ea 04 00 aa&lt;br /&gt;
Hangup        ← a1 af 13 00 50 d4 d6 91 e8 04 00 e2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
During the handshake process, the &amp;lt;code&amp;gt;unk2&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;unk3&amp;lt;/code&amp;gt; fields exhibit a pattern where the &amp;lt;code&amp;gt;unk3&amp;lt;/code&amp;gt; of the preceding packet is used as the &amp;lt;code&amp;gt;unk2&amp;lt;/code&amp;gt; of the next one.  The parties might be agreeing upon a key using a key-exchange scheme?&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
The plaintext form of the RC4 encrypted payload consists of a small header that looks like:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
 |-&lt;br /&gt;
 !  Type&lt;br /&gt;
 !  Name&lt;br /&gt;
 !  Description&lt;br /&gt;
 |-&lt;br /&gt;
 |  u32&lt;br /&gt;
 |  length&lt;br /&gt;
 |  Length of the remaining payload (excluding this field)&lt;br /&gt;
 |-&lt;br /&gt;
 |  u8&lt;br /&gt;
 |  op&lt;br /&gt;
 |  Type of packet&lt;br /&gt;
 |-&lt;br /&gt;
 |  u8&lt;br /&gt;
 |  unk1&lt;br /&gt;
 |  (Only for server-to-client messages, seemingly always 1)&lt;br /&gt;
 |-&lt;br /&gt;
 |  u32&lt;br /&gt;
 |  msgid&lt;br /&gt;
 |  Seemingly used to pair up requests and responses&lt;br /&gt;
 |-&lt;br /&gt;
 |  u32&lt;br /&gt;
 |  unk2&lt;br /&gt;
 |&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
The encrypted payloads exchanged when first connecting look something like (excluding the header):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
→ string deviceID;&lt;br /&gt;
← u16 unk1; u16 unk2; u32 deviceID; u32 length; u8[length] blob; string connectionString; u8[7] unk3; string buildString;&lt;br /&gt;
→ u32 deviceID; u32 unk1;&lt;br /&gt;
← u16 unk1; u16 unk2; u32 length; u8[length] blob;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;code&amp;gt;string&amp;lt;/code&amp;gt; is both length-prefixed (&amp;lt;code&amp;gt;u16&amp;lt;/code&amp;gt;) and zero-terminated (the terminating zero is not included in the length).&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;connectionString&amp;lt;/code&amp;gt; looks like &#039;prudps:/address=203.180.85.79;port=50051;CID=1;PID=2;sid=1;stream=10;type=2&#039; and the &amp;lt;code&amp;gt;buildString&amp;lt;/code&amp;gt; is always &#039;branch:unknown build:2_24_13767_0&#039;.  The &amp;lt;code&amp;gt;deviceID&amp;lt;/code&amp;gt; seems to be unique to each 3DS or perhaps online account (it seems to roughly scale with the age of the 3DS, so that an older 3DS sends a lower ID).&lt;/div&gt;</summary>
		<author><name>Cyuubi</name></author>
	</entry>
	<entry>
		<id>https://www.3dbrew.org/w/index.php?title=PRUDP&amp;diff=20594</id>
		<title>PRUDP</title>
		<link rel="alternate" type="text/html" href="https://www.3dbrew.org/w/index.php?title=PRUDP&amp;diff=20594"/>
		<updated>2018-02-12T17:18:01Z</updated>

		<summary type="html">&lt;p&gt;Cyuubi: Correct PRUDP version&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;PRUDP&#039;&#039;&#039; is a third-party network protocol used for network communications by some Nintendo software on the 3DS.  It presumably stands for &amp;quot;pretty reliable UDP&amp;quot; or &amp;quot;partially reliable UDP&amp;quot; or some such, and essentially implements TCP-like reliability via sequence numbers and acknowledgement within UDP.  Optionally it also adds security (prudps), via RC4 encryption + hashing. This is the protocol used in Nintendo 3DS and Wii U games for online multiplayer comms etc. This can be used with [[NWM_Services|UDS]] local-WLAN too.&lt;br /&gt;
&lt;br /&gt;
At least two different versions of PRUDP seem to be used by Nintendo software: an older version used in the [[Friend Services|Friend services]] and a newer one used in Pokémon X/Y.&lt;br /&gt;
&lt;br /&gt;
== Version 0 ==&lt;br /&gt;
This is the version of the protocol used by the [[Friend Services|Friend services]].&lt;br /&gt;
&lt;br /&gt;
=== Packet structure ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
 |-&lt;br /&gt;
 !  Type&lt;br /&gt;
 !  Name&lt;br /&gt;
 !  Description&lt;br /&gt;
 |-&lt;br /&gt;
 |  u16&lt;br /&gt;
 |  src_dst&lt;br /&gt;
 |  Magic: client-to-server (afa1) or server-to-client (a1af)&lt;br /&gt;
 |-&lt;br /&gt;
 |  u16&lt;br /&gt;
 |  op&lt;br /&gt;
 |  Type of packet&lt;br /&gt;
 |-&lt;br /&gt;
 |  u8&lt;br /&gt;
 |  unk1&lt;br /&gt;
 |&lt;br /&gt;
 |-&lt;br /&gt;
 |  u32&lt;br /&gt;
 |  unk2&lt;br /&gt;
 |&lt;br /&gt;
 |-&lt;br /&gt;
 |  u16&lt;br /&gt;
 |  seqno&lt;br /&gt;
 |  Incrementing ID to pair up data packets and acknowledgement&lt;br /&gt;
 |-&lt;br /&gt;
 |  u8[*]&lt;br /&gt;
 |  payload&lt;br /&gt;
 |&lt;br /&gt;
 |-&lt;br /&gt;
 |  u8&lt;br /&gt;
 |  checksum&lt;br /&gt;
 |  seems to be related to the sum of the rest of the fields (mod 256)&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
Different kinds of packets have different values for the different fields:&lt;br /&gt;
&lt;br /&gt;
* Handshake (1): op=0x40 or op=0x10 (cli-to-serv or serv-to-cli)&lt;br /&gt;
**  unk1, unk2, seqno are 0&lt;br /&gt;
**  payload: u32 unk3;&lt;br /&gt;
&lt;br /&gt;
* Handshake (2): op=0x61 or op=0x11&lt;br /&gt;
**  unk1, seqno are 0&lt;br /&gt;
**  payload: u32 unk3;&lt;br /&gt;
&lt;br /&gt;
* Hangup: op=0x63 or op=0x13&lt;br /&gt;
&lt;br /&gt;
* Heartbeat: op=0x44 or op=0x14&lt;br /&gt;
**  seqno = increasing&lt;br /&gt;
&lt;br /&gt;
* Data packet: op=0x62&lt;br /&gt;
**  seqno = increasing&lt;br /&gt;
**  payload: u8[?] payload;&lt;br /&gt;
&lt;br /&gt;
* Data ack: op=0x12&lt;br /&gt;
**  unk2  = 0x12345678&lt;br /&gt;
**  seqno = corresponding to the data packet being acknowledged&lt;br /&gt;
&lt;br /&gt;
=== Sample session ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Handshake 1   → af a1 40 00 00 00 00 00 00 00 00 00 00 00 00 97&lt;br /&gt;
Handshake 1   ← a1 af 10 00 00 00 00 00 00 00 00 5f 22 68 ea 3a&lt;br /&gt;
Handshake 2   → af a1 61 00 18 5f 22 68 ea 01 00 d4 d6 91 e8 c9&lt;br /&gt;
Handshake 2   ← a1 af 11 00 50 d4 d6 91 e8 01 00 00 00 00 00 de&lt;br /&gt;
Send data     → af a1 62 00 18 26 b4 01 a1 02 00 00 (25 bytes of encrypted payload) ef&lt;br /&gt;
Acknowledge   ← a1 af 12 00 50 78 56 34 12 02 00 00 d1&lt;br /&gt;
Send data     ← a1 af 62 00 50 67 dd f9 c3 01 00 00 (255 bytes of encrypted payload) 03&lt;br /&gt;
Acknowledge   → af a1 12 00 18 78 56 34 12 01 00 00 97&lt;br /&gt;
Send data     → af a1 62 00 18 8d 58 91 c0 03 00 00 (21 bytes of encrypted payload) fa&lt;br /&gt;
Acknowledge   ← a1 af 12 00 50 78 56 34 12 03 00 00 d2&lt;br /&gt;
Send data     ← a1 af 62 00 50 a9 c5 fa 2e 02 00 00 (130 bytes of encrypted payload) 54&lt;br /&gt;
Acknowledge   → af a1 12 00 18 78 56 34 12 02 00 00 98&lt;br /&gt;
Hangup        → af a1 63 00 18 5f 22 68 ea 04 00 aa&lt;br /&gt;
Hangup        ← a1 af 13 00 50 d4 d6 91 e8 04 00 e2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
During the handshake process, the &amp;lt;code&amp;gt;unk2&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;unk3&amp;lt;/code&amp;gt; fields exhibit a pattern where the &amp;lt;code&amp;gt;unk3&amp;lt;/code&amp;gt; of the preceding packet is used as the &amp;lt;code&amp;gt;unk2&amp;lt;/code&amp;gt; of the next one.  The parties might be agreeing upon a key using a key-exchange scheme?&lt;br /&gt;
&lt;br /&gt;
=== Payload ===&lt;br /&gt;
The plaintext form of the RC4 encrypted payload consists of a small header that looks like:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
 |-&lt;br /&gt;
 !  Type&lt;br /&gt;
 !  Name&lt;br /&gt;
 !  Description&lt;br /&gt;
 |-&lt;br /&gt;
 |  u32&lt;br /&gt;
 |  length&lt;br /&gt;
 |  Length of the remaining payload (excluding this field)&lt;br /&gt;
 |-&lt;br /&gt;
 |  u8&lt;br /&gt;
 |  op&lt;br /&gt;
 |  Type of packet&lt;br /&gt;
 |-&lt;br /&gt;
 |  u8&lt;br /&gt;
 |  unk1&lt;br /&gt;
 |  (Only for server-to-client messages, seemingly always 1)&lt;br /&gt;
 |-&lt;br /&gt;
 |  u32&lt;br /&gt;
 |  msgid&lt;br /&gt;
 |  Seemingly used to pair up requests and responses&lt;br /&gt;
 |-&lt;br /&gt;
 |  u32&lt;br /&gt;
 |  unk2&lt;br /&gt;
 |&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
The encrypted payloads exchanged when first connecting look something like (excluding the header):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
→ string deviceID;&lt;br /&gt;
← u16 unk1; u16 unk2; u32 deviceID; u32 length; u8[length] blob; string connectionString; u8[7] unk3; string buildString;&lt;br /&gt;
→ u32 deviceID; u32 unk1;&lt;br /&gt;
← u16 unk1; u16 unk2; u32 length; u8[length] blob;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;code&amp;gt;string&amp;lt;/code&amp;gt; is both length-prefixed (&amp;lt;code&amp;gt;u16&amp;lt;/code&amp;gt;) and zero-terminated (the terminating zero is not included in the length).&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;connectionString&amp;lt;/code&amp;gt; looks like &#039;prudps:/address=203.180.85.79;port=50051;CID=1;PID=2;sid=1;stream=10;type=2&#039; and the &amp;lt;code&amp;gt;buildString&amp;lt;/code&amp;gt; is always &#039;branch:unknown build:2_24_13767_0&#039;.  The &amp;lt;code&amp;gt;deviceID&amp;lt;/code&amp;gt; seems to be unique to each 3DS or perhaps online account (it seems to roughly scale with the age of the 3DS, so that an older 3DS sends a lower ID).&lt;/div&gt;</summary>
		<author><name>Cyuubi</name></author>
	</entry>
</feed>