A method for sterilization and pasteurization includes providing an apparatus including a shock generation section a sterilization section and a membrane provided there between placing media contaminated with microorganisms into the sterilization section introducing a detonable mixture into the shock generation section causing formation of at least one of a shock wave and an acoustic wave by igniting the detonable mixture, so that the at least one of a shock wave and an acoustic wave impinges on the membrane and is transmitted thereby into the sterilization section, and so that the media is sterilized or pasteurized by the at least one of a shock wave and an acoustic wave that will kill at least some of the microorganisms venting the shock generation section via a pressure relief valve and repeating to achieve a pre-determined degree of sterilization or pasteurization.