Github user aaabramov commented on the issue:

    https://github.com/apache/commons-lang/pull/335
  
    > Sounds reasonable in the same time it will not always obviously which 
minMasked to use.
    > For example already mentioned credit card numbers in fact can have 
varying length as I remember up to 24 digits.
    > As I understood I created this function for specific case which you had. 
Can you provide some examples from real life when minMasked was needed?
    
    FYI, card numbers can vary from 13 to 19 digits. PCI DSS allows to log PANs 
mask in such way:
    Here is proper maskifying Scala code:
    ```
        val START_SYMBOLS = 6
        val END_SYMBOLS = 4
        val TOTAL_SYMBOLS: Int = START_SYMBOLS + END_SYMBOLS
    
        private def stars(count: Int): String = "*" * count
    
        def maskify(number): String =
          if (number.length <= 6) {
            number
          } else {
            val maskLength = (number.length - TOTAL_SYMBOLS).max(0)
            val numberFromEnd = maskLength + START_SYMBOLS
            number.substring(0, 6) + stars(maskLength) + 
number.substring(numberFromEnd)
          }
    ```
    
    As a result:
    ```
    4242424242424242     ~> 424242******4242
    424242424242424242 ~>424242********4242
    ```


---

Reply via email to