Which library to use when you want to create password for a door lock system that can be used only once

Good point other wise which password has been used would be lost if the power fails .