**Appendix B**

The pseudo code for constructing the NMSM is provided as follows:

```
(a) Make an n-dimensional array of size 16n using the secret key K
     rng(K);
     for X(0) = 0 : 2 : 15,
     for X(1) = 0 : 2 : 15,
   ...
     for X(n − 1) = 0 : 2 : 15,
          V = randperm(2n) − 1;
          k = 0;
          for X	
                (0) = 0 : 1,
          for X	
                (1) = 0 : 1,
        ...
          for X	
                (n − 1) = 0 : 1,
               M(X	
                    (0), X	
                            (1), ... , X	
                                       (n − 1)) = V(k);
               Mk = k + 1;
          end
        ...
          end
          end
     end
   ...
     end
     end
(b) Repeat the array to obtain NMSM
     for X(1) = 0 : 16 : 255,
     for X(2) = 0 : 16 : 255,
   ...
     for X(n) = 0 : 16 : 255,
          M(X(0) : X(0) + 15, X(1) : X(1) + 15, ... , X(n − 1) : X(n − 1) + 15)
                              = M(0 : 15, 0 : 15, ... , 0 : 15);
     end
   ...
     end
  end
```