Suppose you have a Go program that takes as input a string with a credit card number and saves it to the cardNumber variable.
Your task is to create a function hashCreditCard() that takes as an argument a string cardNumber, uses a switch statement to apply a different hashing algorithm based on the first number of the credit card, and finally returns the hashed cardNumber.
If the
cardNumberstarts with the number3, you should applySHA512to it once;If the
cardNumberstarts with the number4, you should applySHA256to it iteratively4times;If the
cardNumberstarts with the number5, you should applyMD5to it iteratively5times.
Note that you can use the strings.HasPrefix() function to easily check if the credit card number starts with a 3, 4 or 5.