If using unroasted dried shrimp paste for the sauce, wrap it up in a 3-inch-square (7cm) piece of aluminum foil like an envelope. Flatten the packet with the heel of your hand.
Roast the packet on the stovetop directly over a medium-high flame for 2 to 3 minutes, turning occasionally with tongs, until it is briny smelling; expect steam to shoot from the foil. Remove from the heat and let cool. Blast your exhaust to get rid of odor. (If using preroasted shrimp paste, skip this step.)
Use a small food processor to grind the shrimp paste, palm sugar, and chiles to a fine texture. Add the tamarind and sweet soy sauce and process until smooth (you’ll have about 1/2 cup). Transfer to a bowl if using soon. Or, refrigerate in a tightly capped jar for up to a week; return to room temperature before using.
Halve the tofu crosswise, then cut each half into squarish pieces about 2 1/4 inches (5.5cm)wide and 3/4 inch (2cm) thick. You should have 12 pieces total. Put in a bowl. Put the bean sprouts in another bowl. Set aside.
Bring the water to a boil. Turn off the heat. After the boiling subsides, measure 3 cups and add the salt, stirring to dissolve. Pour this salted water over the tofu, covering it. Set aside for 15 minutes.
Pour the remaining (unsalted) hot water over the bean sprouts to cover. When the sprouts have softened, about 2 minutes, drain, flush with cold water, and set aside to drain well. The bean sprouts can be prepped several days in advance and refrigerated.
When the tofu is ready, pour off the water, then transfer the pieces to a non-terry dishtowel or double layer of paper towels placed atop a plate. Let drain for about 15 minutes.
Heat 1 1/2 inches (3 cm) of oil in a wok, deep skillet, or saucepan over high heat to between 360°F - 370°F (182°C - 187°C). Blot excess water from the tofu one last time, then fry in batches of 4 to 6 pieces, sliding them into the oil, then gently stirring them with chopsticks or a skimmer to fry evenly and prevent them from sticking. If they stick, let them fry until they are light golden before nudging them apart, or remove the pieces from the oil, separate, then quickly replace them in the oil to finish frying.
The tofu should be crisp and deep golden after 2 to 3 minutes. Drain the fried tofu on paper towels. Return the oil to temperature before frying another batch. Set aside to cool. The tofu may be fried and refrigerated up to 5 days ahead; return it to room temperature before grilling.