If using unroasted dried shrimp paste for the sauce, wrap it in a 3-inch square (7 cm) 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 smells briny and steam escapes from the foil. Remove from the heat and let cool. Turn on your exhaust fan to eliminate any odors. (If using pre-roasted 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, then process until smooth (you should have about 1/2 cup). Transfer to a bowl if using soon, or refrigerate in a tightly sealed 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.5 cm) wide and 3/4 inch (2 cm) thick, yielding a total of 12 pieces. Place the tofu in a bowl and put the bean sprouts in another bowl. Set aside.
Bring the water to a boil, then turn off the heat. Once the boiling subsides, measure out 3 cups and add the salt, stirring to dissolve. Pour the salted water over the tofu, ensuring it is fully covered. Set aside for 15 minutes.
Pour the remaining hot water (unsalted) over the bean sprouts to cover. When the sprouts have softened, about 2 minutes, drain and rinse with cold water, then set aside to drain well. The bean sprouts can be prepared several days in advance and refrigerated.
When the tofu is ready, pour off the water and transfer the pieces to a non-terry dishtowel or a double layer of paper towels placed on 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 and 370°F (182°C and 187°C). Blot any excess water from the tofu one last time, then fry in batches of 4 to 6 pieces. Slide them into the oil and gently stir with chopsticks or a skimmer to ensure even frying and prevent sticking. If they stick, let them fry until light golden before nudging them apart, or remove the pieces from the oil, separate them, and quickly return them to 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 and return the oil to temperature before frying the next batch. Set the tofu aside to cool. It can be fried and refrigerated for up to 5 days; return it to room temperature before grilling.