built using picocli
I wanted in this project to build a utility that is handy, if you wanted a hash for a text or file or even multiple files, all you going to do is open the terminal or command prompt and type few commands and provide necessary arguments and that is it, you are one press away from your message digest.
with this handy tool you can hash text, a file or multiple files with various hashing functions with ease.
supported hashing functions are the following:
- SHA-1
- SHA-256
- SHA-384
- SHA-512
- SHA-512/224
- SHA-512/256
- SHA3-224
- SHA3-256
- SHA3-384
- SHA3-512
prerequisites
the only prerequisite is having installation of JDK 17 or higher.
the command called: hash
steps for installing:
- go to
Releasesand scroll down to theAssetssection - download
cli-hashed.zip - unzip
cli-hashed.zipfolder, cd to cli-hashed folder, you will find 2 foldersbinandrepoand 1 text file calledhashing_functions.txt - create a system environment variable(not user environment variable) called
HASHING_FUNCTIONScontaining the absolute path tohashing_functions.txt - after setting the system environment variable you can execute the
hash.batfrom the same directory of the launcher scripts i.e.hash.bat
NOTES
- to be able to call
hash.batfrom any directory, you need to add it into yourPATHsystem or user environment variables. - it is not mandatory to call
hash.batwith extension you can call it like thishash - type
hashin your command-line and press Enter for help - in
repothere you will find the dependencies for the program - in
binyou will find the launcher scriptshash.batandhash-linuxfor windows and linux respectively - the directory of launcher scripts is
bin, launcher scripts arehash.batandhash-linux
Installed and tested in WSL2(Windows Subsystem of Linux 2), ubuntu distribution
prerequisites
the only prerequisite is having installation of JDK 17 or higher.
the command called: hash-linux
steps for installing JDK 17
sudo apt update && sudo apt upgradesudo apt install openjdk-17-jdk openjdk-17-jre- Once installed, verify the Java version using the following command:
java -version - installation folder is located at
/usr/lib/jvm/java-17-openjdk-amd64 - you need to create
JAVA_HOMEenvironment variable and export it, to do so
paste this commandexport JAVA_HOME="/usr/lib/jvm/java-17-openjdk-amd64"in.bashrclocated in/$HOME/.bashrc
steps for installing
- go to
Releasesand scroll down to theAssetssection - download
cli-hashed.zip - unzip
cli-hashed.zipfolder in/$HOME/ - take the generated
cli-hashedfolder and place it in/$HOME/.local/bin/ - cd into
cli-hashed, you need to make the launcher script as executable using this commandsudo chmod 755 hash-linux - as in installation of JDK 17 you need to paste this command
export HASHING_FUNCTIONS="/$HOME/.local/cli-hashed/hashing_functions.txt"in.bashrclocated in/$HOME/.bashrc - to be able to call the command
hash-linuxfrom anywhere you need to paste these two commands
CLI_HASHED="/home/kiemkist/.local/cli-hashed"PATH="$PATH:$CLI_HASHED/bin"
in.bashrclocated in/$HOME/.bashrc
NOTES
- I recommend that you arrange the commands in
.bashrcin a proper way so it can be easy on you if you wanted to make any changes - type
hash-linuxin your command-line and press Enter for help - in
repothere you will find the dependencies for the program - in
binyou will find the launcher scriptshash.batandhash-linuxfor windows and linux respectively - the directory of launcher scripts is
bin, launcher scripts arehash.batandhash-linux
examples pictures are taken from a run of the program on windows machine
I was aiming to solidify my understanding of building an app that is designated for the command line, using picocli library eased the process for me, it abstracted a lot of layers to help me focus on the important things, I learned things about java like system properties, calling methods dynamically using .class(it's merely an object representing the class at runtime).
I ventured to git realm and discovered git tags, git Releases. I used semantic versioning specification to version my program, semantic versioning can be used to standardize the process of versioning of your software, I also Learned about one of the ways to package your software using launcher scripts, I used Maven appassembler plugin to achieve that.
It was such a great experience, I Learned a lot, dealing only with the command-line, it exposed me to different perspectives of Windows powershell and Linux bash shell.
I used picocli to build this TUI app, it was seamless and pleasant experience, documentation of picocli was clear and there was a lot of supportive examples.