Preheat oven to 350 degrees F. Grease and flour an 8-inch square baking pan.
Bring the stout to a boil in a medium saucepan over medium heat, stirring occasionally. Remove from the heat and stir in the baking soda (mixture will foam up). When foaming subsides, stir in molasses, brown sugar, and granulated sugar until dissolved; set mixture aside.
Whisk the flour, ground ginger, baking powder, salt, cinnamon and pepper together in a large bowl; set aside.
Transfer the stout mixture to a large bowl. Whisk in the eggs, oil, and grated ginger until combined. Whisk the wet mixture into the flour mixture in thirds, stirring vigorously until completely smooth after each addition.
Transfer the batter to the prepared pan and gently tap the pan against the counter 3 or 4 times to pop any large air bubbles. Bake until the the of the cake is just firm to the touch and a toothpick inserted into the center comes out clean, 35 to 45 minutes. Cool the cake in the pan on a wire rack for 1½ hours. Cut into squares and serve warm or at room temperature. Store leftovers at room temperature, wrapped in plastic wrap, for up to 2 days.
Notes
*Note: This cake does pack some heat thanks to the ginger and pepper. If you are particularly sensitive to spice, you can decrease the amount of dried ginger to 1 tablespoon.