Abstract: A card-based method for generating a dynamic password, in which the method comprises: power on a device, initialize a current running state as a first state, prompt a user to press down a mode key, the device determines an operation to be executed when the mode key is pressed down, obtain input data according to the operation on a number key pressed by the user in the case that a number key is pressed down; obtain a confirm state according to the operation on a state key pressed by the user in the case that a state key is pressed down; otherwise, execute a corresponding operation according to the current running state, the corresponding operation comprises: obtain a dynamic password according to the interaction with the card and preset process the password data and output the dynamic password.