It’s called a blasting machine. My DuPont Blaster’s Handbook (copyright 1930) shows one, a Du Pont No. 5 G. M. (push down) Blasting Machine. Developed by General Motors. It generates a spark to detonate an electrical blasting cap. Would guess that it indeed had a gizmo like a magneto. I’ve listened to the things and it sounds as though the plunger drives a flywheel of sorts to generate the electrical charge. Among it’s features are: “a two-point clutch which enables the current to be sent out at it’s peak; a laminated armature and solid core field for building up the maximum current; a one micro farad condenser to store up the current until the moment of discharge; and a new eight point breaker of unique design which utilizes the current hetetofore in evidence as a large spark at the completion of the stroke. The mechanical improvements consist of the field windings being placed so as to increase the efficiency of the machine; ball bearings on the armature shaft; and a thrust bearing for the rack bar in direct line of thrust instead of offset as formally.” It’s working parts consist of: rack bar, contact spring (which, when struck by the bottom of the descending rack bar, breaks the contact between two small platinum contacts, one on the upper surface of the contact spring and the other on the underside of the bridge, and in this way throws the entire current through the outside circuit, that is, leading wire, electric blasting caps, and connecting wire); field magnets, revolving armature, rack bar handle.
FYI You can’t set off dynamite with a gun, fire, or a fire cracker. You need a blasting cap or another explosion. Nitro glycerin can be set off with a small jolt, black powder can be set off with a spark. Dynamite is SO much safer!