That's pretty darn clever, except that I think you meant to do the trucate prior to the print in rewrite_crc(), otherwise it prints the new crc then truncates it. But this is the basic idea I was looing for.
What a great place our monestary is! Not to mention the fine people!