Drilling square holes
A recent video from China shows this being done using a special drill. Actually the idea is at least 50 years old and may be much older than that.
It involves the use of lobed shape drills and requires a pilot hole of larger than usual size.
A lobed figure is a shape of constant diameter, which is not circular and a little sketch will explain better than words.
Because it is constant diameter it will roll true on a flat surface but be all over the place in a vee block. It is only a matter of putting cutting teeth at the ‘points’ to convert the shape into a drill.
Lobed figures are commonly created in centreless grinding operations as used for roller bearing rollers, and many years ago I produced almost perfect pentagons when setting a rolling machine to roll tiny sheet metal cover plates for AA batteries-they should have been circular!
Making the drawing showed up another characteristic that a lobed figure is possible only with an odd number of lobes.
Precision drilling
Sometimes you may need a precision ground pin of exact size, either tough or hardened. One or two–offs are expensive at a machine shop but perfect pins can be made simply by buying a twist drill of the correct size, and they are obtainable is size ranges of 0.1mm, and hacksawing off the length required from the shank.
Jobbers pattern drills have longer shanks than normal drills if required.
I was amazed that cutting a drill shank was possible but the shank is tough while the flutes are hardened. As proof look at an old drill with the shank damaged by slipping in the drill chuck. Harden by heating to red heat and dropping into a cup of oil, or water if greater hardness required.