Of course this isn't going to be a universal answer to the question of whether data should persist in fields when options change. Every option selection group will have different criteria that could mean that the data should persist or that the data should be destroyed when the options change.
However, in your case, I would recommend destroying the data on option change. The data you are dealing with appears to be security sensitive. Any way of making the data persist in that field would require recording and storing it in some way - this clearly presents a possible security risk which may be expensive to solve.
If you do decide to make the data persist then, depending on the technical solution you are going to use, you could use multiple fields that are swapped in place according to the option selected. This would mean that you would be able to retain data in any field where it was entered and recall that to the screen when the corresponding option was selected. During form submission you must discard the extra data as the user will be unaware that they are submitting it.