For the part of rail-fence cipher, please refer to the implementation of caesar cipher and substitution (not providing you link for rail-fence cipher as it will be a learning part for you to implement) cipher to understand the things that would be included in the script for writing encoder and decoder for a cipher.
Don't do this. Displaying a series of *'s to mask the password is not encryption. MATLAB is still saving the password in an unencrypted state despite what is shown on the screen. All the *'s are doing is hiding a security flaw.
Best Answer