forked from cheat/cheatsheets
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request cheat#38 from 8go/patch-3
added sha256sum
- Loading branch information
Showing
1 changed file
with
30 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
--- | ||
tags: [ cryptography, hash, checksum, verification ] | ||
--- | ||
# To compute hash (checksum) of <file>: | ||
sha256sum <file> | ||
|
||
# To compute hash (checksum) from input text: | ||
# Enter text in keyboard and finish by ctrl-D at beginning of line | ||
sha256sum | ||
Some text | ||
^D | ||
|
||
echo -n "Hello World" | sha256sum | ||
|
||
# To verify if a hash (checksum) is correct if a hash-file is provided: | ||
# sha256sum will go thru the files listed in <file-with-list-of-checksums>. | ||
# For each file it will look if it exists. If not, it will print an error. | ||
# If it does exist it will compute the checksum and compare it with the hash | ||
# provided in the <file-with-list-of-checksums>. If they match (good!) it | ||
# will print "filename: OK". | ||
# If they don't match (warning, you might have been hacked), it will | ||
# print "filename: FAILED". | ||
sha256sum --check <file-with-list-of-checksums> | ||
|
||
# Same as above (but ignore missing files): | ||
# This tells you if your file is an exact copy (OK) or has been | ||
# tampered with (FAILED) without bothering you with warnings about | ||
# missing files | ||
sha256sum --check --ignore-missing <file-with-list-of-checksums> | ||
|