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
Releases
and scroll down to theAssets
section - download
cli-hashed.zip
- unzip
cli-hashed.zip
folder, cd to cli-hashed folder, you will find 2 foldersbin
andrepo
and 1 text file calledhashing_functions.txt
- create a system environment variable(not user environment variable) called
HASHING_FUNCTIONS
containing the absolute path tohashing_functions.txt
- after setting the system environment variable you can execute the
hash.bat
from the same directory of the launcher scripts i.e.hash.bat
NOTES
- to be able to call
hash.bat
from any directory, you need to add it into yourPATH
system or user environment variables. - it is not mandatory to call
hash.bat
with extension you can call it like thishash
- type
hash
in your command-line and press Enter for help - in
repo
there you will find the dependencies for the program - in
bin
you will find the launcher scriptshash.bat
andhash-linux
for windows and linux respectively - the directory of launcher scripts is
bin
, launcher scripts arehash.bat
andhash-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 upgrade
sudo 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_HOME
environment variable and export it, to do so
paste this commandexport JAVA_HOME="/usr/lib/jvm/java-17-openjdk-amd64"
in.bashrc
located in/$HOME/.bashrc
steps for installing
- go to
Releases
and scroll down to theAssets
section - download
cli-hashed.zip
- unzip
cli-hashed.zip
folder in/$HOME/
- take the generated
cli-hashed
folder 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.bashrc
located in/$HOME/.bashrc
- to be able to call the command
hash-linux
from anywhere you need to paste these two commands
CLI_HASHED="/home/kiemkist/.local/cli-hashed"
PATH="$PATH:$CLI_HASHED/bin"
in.bashrc
located in/$HOME/.bashrc
NOTES
- I recommend that you arrange the commands in
.bashrc
in a proper way so it can be easy on you if you wanted to make any changes - type
hash-linux
in your command-line and press Enter for help - in
repo
there you will find the dependencies for the program - in
bin
you will find the launcher scriptshash.bat
andhash-linux
for windows and linux respectively - the directory of launcher scripts is
bin
, launcher scripts arehash.bat
andhash-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.