Place cod in a 2-qt. saucepan; cover by 2″ with cold water. Boil for 20 minutes; drain. Repeat process twice more; finely shred and set aside. Puree dried shrimp, cashews, peanuts, scallions, chiles, garlic and ginger in a food processor; set shrimp paste aside. Combine bread and coconut milk in a food processor; let sit for 20 minutes. Puree; set bread paste aside.
Heat oil in a 4-qt. saucepan over medium-high heat. Add onion; cook until soft, about 13 minutes. Add shrimp paste; cook for 2 minutes. Add tomatoes; cook until broken down, about 6 minutes. Add cod, bread paste, and stock; boil. Reduce heat to medium; cook until reduced by one quarter, about 30 minutes. Add shrimp; cook until shrimp are pink and cooked through, about 3 minutes. Season with salt and pepper; serve with rice.
