Obsfucate text string

I need to generate obfuscated version of private/sensitive text strings like ID card numbers, so we can store them in a database and display them to users in a form where they can confirm the information is correct, or input new data if necessary.

For example, if it’s ID number 1234567890 I want to *-out all except the final 3 digits, so we can display *******890 to the user, this is enough for them to check its the correct number, without us storing or displaying the full ID number in plain text.

What’s the easiest way to generate an obsfucated text string like this in Make?

The original plain text strings will be variable length, and could include upper case, lowercase and numeric characters. Possibly could also include dash and other kinds of characters.

You could use the substring and length built-in functions to only return the last N characters of the string:



If you want the length of the output to match the length of the input, then:


Thanks Sam, this is exactly what I was looking for!