I mean essentially copy your unmasked string into a new string builder starting from index 0 and once you hit index[length-5] just put x's

Liberty has never come from the government.
Liberty has always come from the subjects of government.
The history of liberty is the history of resistance.
The history of liberty is a history of the limitation of governmental power, not the increase of it.