Data masking algorithms are by the mask features of Apache ShardingSphere. A variety of algorithms are built-in to make it easy for users to fully leverage the feature.
Type: MD5
Attributes:
| Name | DataType | Description | 
|---|---|---|
| salt | String | Salt value (optional) | 
Type: KEEP_FIRST_N_LAST_M
Attributes:
| Name | DataType | Description | 
|---|---|---|
| first-n | int | first n substring | 
| last-m | int | last m substring | 
| replace-char | String | replace char | 
Type: KEEP_FROM_X_TO_Y
Attributes:
| Name | DataType | Description | 
|---|---|---|
| from-x | int | start position (from 0) | 
| to-y | int | end position (from 0) | 
| replace-char | String | replace char | 
Type: MASK_FIRST_N_LAST_M
Attributes:
| Name | DataType | Description | 
|---|---|---|
| first-n | int | first n substring | 
| last-m | int | last m substring | 
| replace-char | String | replace char | 
Type: MASK_FROM_X_TO_Y
Attributes:
| Name | DataType | Description | 
|---|---|---|
| from-x | int | start position (from 0) | 
| to-y | int | end position (from 0) | 
| replace-char | String | replace char | 
Type: MASK_BEFORE_SPECIAL_CHARS
Attributes:
| Name | DataType | Description | 
|---|---|---|
| special-chars | String | Special chars (first appearance) | 
| replace-char | String | replace char | 
Type: MASK_AFTER_SPECIAL_CHARS
Attributes:
| Name | DataType | Description | 
|---|---|---|
| special-chars | String | Special chars (first appearance) | 
| replace-char | String | replace char | 
Type: GENERIC_TABLE_RANDOM_REPLACE
Attributes:
| Name | DataType | Description | 
|---|---|---|
| uppercase-letter-codes | String | Uppercase letter codes (separate with comma, default value: A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z) | 
| lowercase-letter-codes | String | Lowercase-letter codes (separate with comma, default value: a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z) | 
| digital-random-codes | String | Numbers (separate with comma, default value: 0,1,2,3,4,5,6,7,8,9) | 
| special-codes | String | Special codes (separate with comma, default value: ~,!,@,#,$,%,^,&,*,:,<,>,¦) | 
rules:
- !MASK
  tables:
    t_user:
      columns:
        password:
          maskAlgorithm: md5_mask
        email:
          maskAlgorithm: mask_before_special_chars_mask
        telephone:
          maskAlgorithm: keep_first_n_last_m_mask
  maskAlgorithms:
    md5_mask:
      type: MD5
    mask_before_special_chars_mask:
      type: MASK_BEFORE_SPECIAL_CHARS
      props:
        special-chars: '@'
        replace-char: '*'
    keep_first_n_last_m_mask:
      type: KEEP_FIRST_N_LAST_M
      props:
        first-n: 3
        last-m: 4
        replace-char: '*'
