Tutoriel N° 2cd
Test sha256sum of a file on linux
I create a file and check his sha256sum for the test
shareannonce@shareannonce:~$ sha256sum test.txt
310f213cc30e6ca3d19f519f746706ff95422bf30a1da4ec3d88fa2f89a00ae7 test.txt
shareannonce@shareannonce:~$ echo "310f213cc30e6ca3d19f519f746706ff95422bf30a1da4ec3d88fa2f89a00ae7" test.txt | sha256sum -c
test.txt: OK
Return a sha256sum without tiret (-) in a variable
shareannonce@shareannonce:~$ nano script.sh
#!/bin/sh
read question
reponse=$(echo -n "$question" | sha256sum | cut -d' ' -f1)
echo $reponse
read question
reponse=$(echo -n "$question" | sha256sum | cut -d' ' -f1)
echo $reponse