We use algorithm MD5 and password myPassword: ./hash MD5 myPassword
Output: 3rFTb0gEdffVkyGaoa/XTA==
Different password or hash algorithm will return another hash: ./hash MD5 testPassword
Output: /tO2GyYIGEk3gICzTmk9Lg==
We use algorithm SHA3-512 and password myPassword: ./hash SHA3-512 myPassword
Output: e9NoZl7gdhx+atbv1M3I9ROijXEFim5qKa1Rwi3VXp0PiXcdCeCWHq7ptzTod29gpCd7tFWiPT1IRaMazItVOA==
Error messages:
We use an invalid algorithm and password myPassword: ./hash SHA5 myPassword
Output: Unknown algorithm
We use a valid algorithm which is not implemented by default and password myPassword: ./hash MD5SHA1 myPassword
Output: No implementation found
We use only one or no command line arguments:
./hash
This prints the usage:
Output: Usage: hash <algorithm> <password>