Ansem's Code

Ansem's Code is a code Ansem the Wise hid inside Sora's heart, after Roxas returned to Sora and before Sora awakens.

Between Kingdom Hearts Chain of Memories and Kingdom Hearts II
While Naminé works to repair Sora's scattered memories, she uncovers memories that don't belong to Sora himself, but to people he is connected to. However, she concludes that they still belong in his heart, and so she does not remove them. Ansem the Wise, under his alternate persona DiZ, is intrigued and researches the boy's heart further.

After Roxas returns to Sora, DiZ begins to feel remorse for the harm he had done to Naminé and Roxas. DiZ makes a digital copy of himself as well as his research, called Ansem's Code, and hides it within Sora's heart in hopes that it can one day be used for atonement. He informs Naminé of this, but does not elaborate on the Code's contents.

Sometime after the Code has been inserted, Naminé also adds a data copy of herself for a similar purpose.

Blank Points
One year later, after being transported to the Realm of Darkness following the explosion of his Kingdom Hearts Encoder, Ansem the Wise encounters Aqua at the Dark Margin. While speaking with her, he reflects on his past misdeeds, and mentions hiding Ansem's Code within Sora.

Kingdom Hearts coded
When Data-Sora encounters Data-Naminé in the datascape's Castle Oblivion, she explains her finding of the memories that don't belong to Sora, but warns that the memories are all painful. Data-Sora and King Mickey accept the memories, where they see visions of Axel, Roxas, Xion, Naminé herself, Terra, Ventus, and Aqua. Finally, Data-Naminé informs them of the existence of Ansem's Code within Sora.

Afterwards, Mickey writes a bottled letter to the real Sora to inform him of the extra memories, and to call him to action in rescuing the people he saw in the visions.

Kingdom Hearts 3D: Dream Drop Distance
After Riku dives into Sora's heart and frees him from Ventus's possessed Keyblade Armor, he arrives on a digital projection of the Destiny Islands within Sora's heart. Here, he speaks to the three people whose hearts lay dormant within Sora's: Roxas, Ventus, and Xion. Riku picks up a message in a bottle that washes up on the beach, and is approached by Ansem the Wise's data copy, who explains that the bottle contains Ansem's Code.

Between Kingdom Hearts 3D: Dream Drop Distance and Kingdom Hearts III
Riku gives Ansem's Code to King Mickey, who then gives it to Chip and Dale, but they find that the Code is encrypted and needs to be deciphered. Having learned of the recompletion of Ansem's apprentices from Lea, Mickey contacts Ienzo at Radiant Garden for assistance.

Kingdom Hearts III
While Sora visits various worlds in hopes of regaining his lost power of waking, he is contacted by Ienzo and frequently updated on the process of deciphering Ansem's Code.

Initially Ienzo has not made much progress, but gains inspiration after speaking to Sora about his shared heart with Roxas. Ienzo is able to progress further after collaborating with Pence to connect Radiant Garden's computer with Ansem the Wise's computer in the Twilight Town mansion's basement.

After Sora visits Monstropolis and encounters Vanitas, Ienzo contacts Sora once more with an entire passage recovered from the data. Some time after this, but before Sora arrives at the Keyblade Graveyard, Ienzo records his findings in Secret Reports 9 and 10.

Contents
One of the subjects inside the data is about the three compartmentalized "boxes" inside Sora, each one containing the heart of another person: one box holds Roxas's heart; another one holds Xion's heart, and the third one, which has been with Sora for a much longer time, holds Ventus's heart. These three hearts have melded with Sora's and no longer have voices of their own; as such, attempting to manually extract them from Sora's heart can be just as deadly as becoming a Heartless.