date int64 1,220B 1,719B | question_description stringlengths 28 29.9k | accepted_answer stringlengths 12 26.4k | question_title stringlengths 14 159 |
|---|---|---|---|
1,333,655,309,000 |
After downloading a file that has a md5 checksum available I currently check it with
md5 *file* | grep *given_checksum*
e.g.
md5 file.zip | grep -i B4460802B5853B7BB257FBF071EE4AE2
but it seemed funny to me to require grep and the pipe for what is surely a very common task. A stickler for doing things efficiently, I... |
md5sum has a -c option to check an existing set of sums, and its exit status indicates success/failure.
Example:
$ echo "ff9f75d4e7bda792fca1f30fc03a5303 package.deb" | md5sum -c -
package.deb: OK
Find a nice resource here
| A simpler way of comparing md5 checksum? |
1,333,655,309,000 |
I have an ISO file, which I burned to a CD. Now how can I check if the CD is correctly created? I would like a command that calculate the hash sum that I can use to check with the hash sum I calculate on the ISO file. Ideally the command should:
Work regardless of the ISO file: that is, I don't want to keep a list of... |
The basic problem is that we want to take the md5sum of the exact same information that was on the ISO originally. When you write the ISO to a CD, there is likely blank space on the end of the disk, which inevitably changes the md5sum. Thus, the the very shortest way:
md5sum /dev/cdrom
doesn't work. What does work... | Calculate md5sum of a CD/DVD |
1,333,655,309,000 |
I have a bunch of Class 10 UHS-1 SDHC SD cards from different manufacturers. They are all partitioned as follows
$ sudo fdisk -l /dev/sdj
Disk /dev/sdj: 14.9 GiB, 15931539456 bytes, 31116288 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal):... |
Did you compare their contents immediately after writing the duplicated contents? If yes, they should come out exactly the same. For example,
# Duplicate
dd bs=16M if=/dev/sdg of=/dev/sdk
# Comparing should produce no output
cmp /dev/sdg /dev/sdk
# Compare, listing each byte difference; also no output
cmp -l /dev/sdg... | Why do these duplicated SD cards have different sha1sums for their content? |
1,333,655,309,000 |
I am confused how md5sum --check is supposed to work:
$ man md5sum
-c, --check
read MD5 sums from the FILEs and check them
I have a file, I can pipe it to md5sum:
$ cat file | md5sum
44693b9ef883e231cd9f90f737acd58f -
When I want to check the integrity of the file tomorrow, how can I check if the
md5sum is stil... |
You do this:
cat file | md5sum > sumfile
And the next day you can do this:
cat file | md5sum --check sumfile
Which prints:
-: OK
if everything is alright.
| check md5sum from pipe |
1,333,655,309,000 |
When I log in to an SSH server/host I get asked whether the hash of its public key is correct, like this:
# ssh 1.2.3.4
The authenticity of host '[1.2.3.4]:22 ([[1.2.3.4]:22)' can't be established.
RSA key fingerprint is SHA256:CxIuAEc3SZThY9XobrjJIHN61OTItAU0Emz0v/+15wY.
Are you sure you want to continue connecting (... |
ssh
# ssh -o "FingerprintHash sha256" testhost
The authenticity of host 'testhost (256.257.258.259)' can't be established.
ECDSA key fingerprint is SHA256:pYYzsM9jP1Gwn1K9xXjKL2t0HLrasCxBQdvg/mNkuLg.
# ssh -o "FingerprintHash md5" testhost
The authenticity of host 'testhost (256.257.258.259)' can't be established.
EC... | How to compare different SSH fingerprint (public key hash) formats? |
1,333,655,309,000 |
I am looking for a simple way to pipe the result of md5sum into another command. Something like this:
$echo -n 'test' | md5sum | ...
My problem is that md5sum outputs not only the hash of the string, but also an hypen, which indicates that the input came from stdin. I checked the man file and I didn't find any flags ... |
You can use the command cut; it allows you to cut a certain character/byte range from every input line. Since the MD5 hash has fixed length (32 characters), you can use the option -c 1-32 to keep only the first 32 characters from the input line:
echo -n test | md5sum | cut -c 1-32
Alternatively, you can tell cut to s... | How to pipe md5 hash result in shell |
1,333,655,309,000 |
I began to use org-mode for planning out my tasks in GTD-style system. Putting every org files in a directory of a Dropbox folder, I run emacs to edit / manage these files from three different local machines: Cygwin, Mac OS X, and Debian. As I also use MobileOrg to access these org files from my iPad, a checksums.dat ... |
Possible commands to generate a checksum
Unfortunately, there's no standard utility to generate a cryptographic checksum. There is a standard utility to generate a CRC: cksum; this may be sufficient for your purpose of detecting changes in a non-hostile environment.
I would recommend using SHA1 rather than MD5. There ... | how can a makefile detect whether a command is available in the local machine? |
1,333,655,309,000 |
So I'm setting up a WordPress backup guide/making a backup schedule for myself for real.
I want to do MySQL dumps daily, but the command either requires
-p then user input
or
--password="plain text password"
Could I pass it to a file that is atleast MD5 or better hashed and protected to increase security but mak... |
You have following password options:
provide the password on the command line through the -p option
provide the password via the MYSQL_PWD environment variable
put your configuration in the ~/.my.cnf file under the [mysqldump] section
In all cases your client needs a plain text password to be able to authenticate. ... | MySQLdump via crontab - Pass --password=/hashed/password/file so I can use via crontab w/o using plain text password |
1,333,655,309,000 |
I want to find the md5 hash of the string "a", but running echo "a" | md5sum gives me another hash than what I get if I search the internet (for example using DuckDuckGo or the first search result I found).
Running echo "a" | md5sum gives me "60b725f10c9c85c70d97880dfe8191b3", but it should be "0cc175b9c0f1b6a831c399e... |
The reason for the hashes being different is that echo includes a newline at the end of the output string to make it pretty. This can be prohibited by the -n flag (if your implementation of echo supports it), or by using another program (like printf):
> echo "a" | md5sum
60b725f10c9c85c70d97880dfe8191b3 -
> echo ... | Why does `md5sum` not give the same hash as the Internet does? |
1,333,655,309,000 |
I often have large directories that I want to transfer to a local computer from a server. Instead of using recursive scp or rsync on the directory itself, I'll often tar and gzip it first and then transfer it.
Recently, I've wanted to check that this is actually working so I ran md5sum on two independently generated t... |
From the looks of things you’re probably being bitten by gzip timestamps; to avoid those, run
GZIP=-n tar -zcvf ...
Note that to get fully reproducible tarballs, you should also impose the sort order used by tar:
GZIP=-n tar --sort=name -zcvf ...
If your version of tar doesn’t support --sort, use this instead:
find ... | Tar produces different files each time |
1,333,655,309,000 |
Situation
I'm on FreeBSD 11.2 without GUI. I'm brand new to BSD systems.
Suppose we have a SHA512SUM file generated on FreeBSD with:
sha512 encrypt-file-aes256 decrypt-file-aes256 > SHA512SUM
It looks different from the Linux format, which from Linux can be generated using --tag switch:
SHA512 (encrypt-file-aes256) =... |
You can use the shasum (man page) tool, which has a -c option to check against a checksum file and is a front-end to several checksum algorithms including SHA-512.
You can use a command like the one below to check both files:
$ shasum -a 512 -c SHA512SUM.sha512sum
The shasum tool is only able to parse the output form... | How to check a hash sum file on FreeBSD? |
1,333,655,309,000 |
When it comes to passwd/user-password-crypted statement in a preseed file, most examples use an MD5 hash. Example:
# Normal user's password, either in clear text
#d-i passwd/user-password password insecure
#d-i passwd/user-password-again password insecure
# or encrypted using an MD5 hash.
#d-i passwd/user-password-cr... |
You can use anything which is supported in the /etc/shadow file. The string given in the preseed file is just put into /etc/shadow. To create a salted password to make it more difficult just use mkpasswd with the salt option (-S):
mkpasswd -m sha-512 -S $(pwgen -ns 16 1) mypassword
$6$bLyz7jpb8S8gOpkV$FkQSm9YZt6SaMQM7... | What hash algorithms can I use in preseed's passwd/user-password-crypted entry? |
1,333,655,309,000 |
I was trying to compute sha256 for a simple string, namely "abc". I found out that using sha256sum utility like this:
sha256sum file_with_string
gives results identical to:
sha256sum # enter, to read input from stdin
abc
^D
namely:
edeaaff3f1774ad2888673770c6d64097e391bc362d7d6fb34982ddf0efd18cb
Note, that before t... |
The difference is the newline. First, let's just collect the sha256sums of abc and abc\n:
$ printf 'abc\n' | sha256sum
edeaaff3f1774ad2888673770c6d64097e391bc362d7d6fb34982ddf0efd18cb -
$ printf 'abc' | sha256sum
ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad -
So, the ba...ad sum is for the str... | Why are end-of-file and end-of-input-signal treated differently by sha256sum? |
1,333,655,309,000 |
I have downloaded a Debian ISO with jigdo, the download has finished successfully, and printed the following message:
FINISHED --2021-01-22 11:57:20--
Total wall clock time: 4.3s
Downloaded: 9 files, 897K in 1.8s (494 KB/s)
Found 9 of the 9 files required by the template ... |
MD5 and SHA-1 are both vulnerable to (chosen-prefix) collision attacks. The SHA2 (SHA-256, SHA-384, SHA-512, …) and SHA3 families of hash functions are not.
What a chosen-prefix collision attack means is that given a prefix and a suffix, it's possible to find two middles such that prefix+middle1+suffix and prefix+midd... | Why is verifying downloads with MD5 hash considered insecure? |
1,333,655,309,000 |
I have to test a hash function and I want to change only a single bit of a specific file.
I tried with the dd command. That works, but I can only change a whole byte and not just a bit.
sudo dd if=/dev/zero of=/file.bin bs=1 seek=10 count=1 conv=notrunc
I also tried the sed command with a regex, but as I don't know ... |
Since the file may contain nulls, text-oriented filters like sed are going to fail. But you can use a programming language that can handle nulls, like perl or python. Here's a solution for Python 3. It's a few lines longer than strictly necessary, for readability.
#!/usr/bin/env python3
"""Toggle the bit at the specif... | Change only one bit in a file |
1,333,655,309,000 |
Background
I am about to migrate files from my old NAS to a new one, and want to verify the data integrity. The old NAS (Debian) is using Linux Ext3 file system, whilst the new one (FreeNAS) is based on ZFS. To speed up the integrity validation I am trying to use the triage approach:
first validate all file sizes
sec... |
You can use dd to pipe only the first 512 bytes to md5sum. However this will cause md5sum to be oblivious of the filename, so in addition replace - with the filename again.
find . -type f -exec sh -c "dd if={} bs=512 count=1 2>/dev/null | md5sum | sed s\|-\|{}\|" \; | sort -k 34;
| md5 hash only first 512 bytes of file |
1,333,655,309,000 |
So I'm trying to check dozens of files using a shell script. The file check happens at different times.
Is there a way to do this?
md5sum -c 24f4ce42e0bc39ddf7b7e879a File.name
or even better sha512sum
sha512sum -c 24f4ce42e0bc39ddf7b7e879a File.name
Right now I have to do this:
md5sum -c file.md5sums File.name
... |
If you're doing this in a script then you can just do a simple comparison check
e.g.
if [ "$(md5sum < File.name)" = "24f4ce42e0bc39ddf7b7e879a -" ]
then
echo Pass
else
echo Fail
fi
Note the extra spaces and - needed to match the output from md5sum.
You can make this a one-liner if it looks cleaner
[[ "$(md5sum <... | md5sum check (no file) |
1,333,655,309,000 |
I'm puzzled by the hash (ASCII) code stored under Linux (Ubuntu) /etc/shadow.
Taking a hypothetical case, let password be 'test', salt be 'Zem197T4'.
By running following command,
$ mkpasswd -m SHA-512 test Zem197T4
A long series of ASCII characters are generated (This is actually how Linux store in the /etc/shadow)
... |
On Ubuntu/Debian mkpasswd is part of the package whois and implemented in mkpasswd.c which as actually just a sophisticated wrapper around the crypt() function in glibc declared in unistd.h. crypt() takes two arguments password and salt. Password is "test" in this case, salt is prepended by "$6$" for the SHA-512 hash ... | SHA512 salted hash from mkpasswd doesn't match an online version |
1,333,655,309,000 |
I want to know my /etc/shadow password hash if its SHA or MD or something else. From what I read, it is related to the $ sign, but I don't have any dollar signs.
Im using Ubuntu 16
Example:
user:0.7QYSH8yshtus8d:18233:0:99999:7:::
|
The shadow(5) manual on Ubuntu refers to the crypt(3) manual. The crypt(3) manual says that the default password encryption algorithm is DES.
It goes on to say that the glibc2 library function also supports MD5 and at least SHA-256 and SHA-512, but that an entry in /etc/shadow for a password encrypted by one of these... | How to know if password in /etc/shadow is hashed with SHA or MD? |
1,333,655,309,000 |
In a directory withmultiple subdirectories but only one folder deep containing tiff-files I'd like to generate a md5 checksum that writes the filename with the corresponding checksum into a textfile.
For example in directory TIFF I have 2 subdirectories:
TIFF
|- b0125TIFF
|- b_0000_001.tif
|- b_0000_... |
You don't want to pass the output of the find and md5 through md5, that would just give you an MD5 checksum of a lot of MD5 checksums...
$ find TIFF -type f -name '*.tif' -exec md5 {} ';' >md5.txt
$ cat md5.txt
MD5 (TIFF/b0125TIFF/file-1.tif) = d41d8cd98f00b204e9800998ecf8427e
MD5 (TIFF/b0125TIFF/file-2.tif) = d41d8c... | OSX: Generate MD5 checksum recursively in a textfile containing files with corresponding checksum |
1,333,655,309,000 |
I used md5sum with pv to check 4 GiB of files that are in the same directory:
md5sum dir/* | pv -s 4g | sort
The command completes successfully in about 28 seconds, but pv's output is all wrong. This is the sort of output that is displayed throughout:
219 B 0:00:07 [ 125 B/s ] [> ] 0% ... |
The pv utility is a "fancy cat", which means that you may use pv in most situations where you would use cat.
Using cat with md5sum, you can compute the MD5 checksum of a single file with
cat file | md5sum
or, with pv,
pv file | md5sum
Unfortunately though, this does not allow md5sum to insert the filename into its ... | Using pv with md5sum |
1,333,655,309,000 |
I would like to rename some files to their contents' MD5 sum; for example, if file foo is empty, it should be renamed to d41d8cd98f00b204e9800998ecf8427e.
Does it have to be script or can I use something like the rename tool?
|
Glenn's answer is good; here's a refinement for multiple files:
md5sum file1 file2 file3 | # or *.txt, or whatever
while read -r sum filename; do
mv -v "$filename" "$sum"
done
If you're generating files with find or similar, you can replace the md5sum invocation with something like find . <options> -p... | How to rename multiple files to their contents' MD5 sum? |
1,333,655,309,000 |
I would like to get the sha1 checksums of all files inside a simple tar archive as a list, or a new file
Without using the disk space to unpack the big tar file. Something with piping and calculating the sha1 on the fly, directing the output to /dev/null
I searched google a lot and did some experiments with pipes but ... |
Too easy :
tar xvJf myArchive.tar.xz --to-command=sha1sum
The result is like this :
z/
z/DOCUMENTATION
3c4d9df9bcbd1fb756b1aaba8dd6a2db788a8659 *-
z/getnameenv.sh
1b7f1ef4bbb229e4dc5d280c3c9835d9d061726a *-
Or create "tarsha1.sh" with :
#!/bin/bash
sha1=`sha1sum`
echo -n $sha1 | sed 's/ .*$//'
echo " $TAR_FILENAME"... | How to create sha1 checksums of files inside a tar archive without using much disk space |
1,382,691,864,000 |
I want to search the file and replace specific pattern with its hash (SHA1) values.
For example, let file.txt has the following content:
one S56G one two three
four five V67X six
and I want to replace the pattern [A-Z][0-9]\{2\}[A-Z] with SHA1 value of the match. In the example above, the matches are S56G and V67... |
In your attempt the command substitution ($(…)) is performed before sed being executed and the string passed to it as parameter.
Use a scripting language which regular expression substitution supports code execution:
perl -MDigest::SHA=sha1_hex -pe 's/[A-Z][0-9]{2}[A-Z]/sha1_hex$&/ge' inputfile
php -R 'echo preg_repl... | using sed to replace pattern with hash values |
1,382,691,864,000 |
How can I make a file digest under Linux with the RIPEMD-160 hash function, from the command line?
|
You can use openssl for that (and for other hash algorithms):
$ openssl list-message-digest-commands
md4
md5
mdc2
rmd160
sha
sha1
$ openssl rmd160 /usr/bin/openssl
RIPEMD160(/usr/bin/openssl)= 788e595dcadb4b75e20c1dbf54a18a23cf233787
| RIPEMD-160 file digest |
1,382,691,864,000 |
I'm experiencing exactly the same issue as described in this question: Kali Linux: apt-get update returns “Hash Sum mismatch” error. Before you mark this as a duplicate however, I have tried the solutions posted there, as well as on numerous other sites, including:
sudo apt-get clean
sudo rm -rf /var/lib/apt/lists/*
s... |
QUICK FIX:
Shut down Kali VM.
Run bcdedit /set hypervisorlaunchtype off in CMD.
Reboot.
EXPLANATION:
This issue is caused by the Windows Hypervisor Platform.
This issue cannot be resolved for now (as far as I know).
A partial fix is at hand though. And I say "partial" because it involves disabling the platform (also... | Kali Linux: apt update returns "Hash Sum mismatch" error |
1,382,691,864,000 |
If I want make a md5sum list recursively, then I would use md5deep, but it starts to pop up some problems such as it won't generate the md5sum file in alphabetical order. For example,
$ cd /media/sdcard/DCIM
$ md5deep -rl *
d41d8cd98f00b204e9800998ecf8427e 2014-12-01/IMG_1969.png
c3a9d8cb047192a03b857023948a7ba6 2014-... |
You can just pass through sort:
$ md5deep -rl * | sort -k2
d41d8cd98f00b204e9800998ecf8427e 2014-12-01/IMG_1969.png
bd12c358db0c97230b9d48f67b2c0c98 2014-12-01/IMG_1970.png
c3a9d8cb047192a03b857023948a7ba6 2014-12-01/IMG_1971.png
If your file name can contain newlines or other strangeness, use this instead (assumes G... | How to make a list generated by md5deep in alphabetical order of relative paths? |
1,382,691,864,000 |
Is there any fast method to delete duplicates of files based on any hash sum (i.e. SHA1 to be fast). Because I've got some mess in my music files.
|
There is package fdupes in linux (for example, it is present in debian repository). It uses md5sums and then a byte by byte comparison to find duplicate files within a set of directories. It also can delete dups with -d option, but I've never used that option. Also you can grep or sed from output files to delete and r... | How to delete duplicates of files in directory and subdirs? |
1,382,691,864,000 |
Given a file like:
a
b
c
How do I get an output like:
a 0cc175b9c0f1b6a831c399e269772661
b 92eb5ffee6ae2fec3ad71c777531578f
c 4a8a08f09d37b73795649038408b5f33
in an efficient way? (Input is 80 GB)
|
This could just be a oneliner in perl:
head 80gb | perl -MDigest::MD5=md5_hex -nlE'say"$_\t".md5_hex($_)'
a 0cc175b9c0f1b6a831c399e269772661
b 92eb5ffee6ae2fec3ad71c777531578f
c 4a8a08f09d37b73795649038408b5f33
d 8277e0910d750195b448797616e091ad
e e1671797c52e15f763380b45e841ec32
f ... | Compute md5sum for each line in a file |
1,382,691,864,000 |
I have a 660297728 byte HDD image with MD5 hash f5a9d398e974617108d26c1654fe7bcb:
root@T42# ls -l image
-rw-rw-r-- 1 noc noc 660297728 Sep 29 19:00 image
root@T42# md5sum image
f5a9d398e974617108d26c1654fe7bcb image
Now if I dd this image file to /dev/sdb disk and check the MD5 hash of the disk, then it is different... |
Is /dev/sdb exactly 660297728 bytes large? (blockdev --getsize64 /dev/sdb). If not, the checksum would naturally be different. Use cmp image /dev/sdb to find out where the differences are in detail. If it says EOF on image, it's identical.
| HDD image file checksum does not match with device checksum |
1,382,691,864,000 |
Is there a way to store my password in /etc/wpa_supplicant/wpa_supplicant.conf as some hash instead of plaintext?
By "password" I refer here to the password used for phase2 authentification. I do not refer to the Preshared Key (PSK) which could be hashed using wpa_passphrase.
For phase2 MSCHAPv2 or MSCHAP authentifica... |
Unfortunately I have to answer the question myself now. "Unfortunately" because the answer is "No, it is not possible".
I took a look at how PAP is working, and came to the conclusion that it is logically impossible to store the password as a hash value.
With PAP, the username and password are sent directly to the aut... | wpa_supplicant store password as hash (WPA-EAP with phase2="auth=PAP") |
1,382,691,864,000 |
Is it possible to use kernel cryptographic functions in the userspace? Let's say, I don't have md5sum binary installed on my system, but my kernel has md5sum support. Can I use the kernel function from userspace? How would I do it?
Another scenario would be, if I don't trust the md5sum binary on my system (my system c... |
According to this article titled: A netlink-based user-space crypto API it would appear that what you're proposing is possible. I'm not sure how to answer your question any further than this article though.
| Using kernel cryptographic functions |
1,382,691,864,000 |
Why there are 12 md5 sums while there are only 5 ISOs in Debian's official site?
http://cdimage.debian.org/debian-cd/current/i386/iso-dvd/
I just download the debian-8.5.0-i386-DVD-1.iso and check the md5 sum, which does not match the given value. Because the md5sum file in the above link has too many entries, therefo... |
Some Images are missing! Only the first n images are available! Where is the rest?
We don't store/serve the full set of ISO images for all architectures, to reduce the amount of space taken up on the mirrors. You can use the jigdo tool to recreate the missing ISO images instead.
| md5 sum in debian's official directory |
1,382,691,864,000 |
I have 2 files test.txt and test.txt.md5. I would like to verify the checksum of test.txt.
The gnu tool md5sum requires an md5 file with the following format "[md5-hash][space][space][filename]" (md5sum -c test.txt.md5). Unfortunately my test.txt.md5 only contains the md5 hash (without the spaces and filename).
How c... |
Like many commands, md5sum has the ability to read from the standard input if an option's value is - (from man md5sum):
Print or check MD5 (128-bit) checksums. With no FILE, or when FILE is -, read standard input.
Since you know the file name, you could simply print the contents of your md5 file, a couple of spaces... | How to use md5sum for checksum with an md5 file which doesn't contain the filename |
1,382,691,864,000 |
I have a file x1 in one directory (d1) and I'm not sure if the same
file is already copied (x2) in another directory (d2) (but automatically
renamed by application).
Can I check if hash of file x1 from directory d1 is equal to hash of some file x2 existing in directory d2?
|
This is a good approach, but the search will be a lot faster if you only calculate hashes of files that have the right size. Using GNU/BusyBox utilities:
wanted_size=$(stat -c %s d1/x1)
wanted_hash=$(sha256sum <d1/x1)
find d2 -type f -size "${wanted_size}c" -execdir sh -c 'test "$(sha256sum <"$0")" = "$1"' {} "$wanted... | Find a file by hash |
1,382,691,864,000 |
I apologize if this has already been answered, or if the answer is simpler than I realize, but I can't seem to figure out the following:
When I try to generate an md5 from a string, either with
echo -n "string" | md5sum | cut -f1 -d' '
or with
echo -n "string" | openssl md5
the result is not 32 characters, as I wo... |
It's 32 characters! The md5sum is adding a linefeed to the end. You can get rid of it like this:
% echo -n string | md5sum|awk '{print $1}'|wc -c
33
% echo -n $(echo -n string | md5sum|awk '{print $1}')|wc -c
32
or you could do it like this:
% echo -n $(md5sum <<< 'string'|awk '{print $1}')|wc -c
32
You can tell whe... | Trailing space when generating md5 |
1,382,691,864,000 |
I have a directory full of files. Each file will be copied to a specific type of destination host.
I want to calculate an MD5 sum for each file in the directory, and store that md5 sum in a file that matches the name of the file that generated the sum, but with .md5 appended.
So, for instance, if I have a directory wi... |
cd /path/to/files &&
for file in *; do
if [[ -f "$file" ]]; then
md5sum -- "$file" > "${file}.md5"
fi
done
| Generate MD5sum for all files in a directory, and then write (filename).md5 for each file containing that file's MD5SUM |
1,382,691,864,000 |
I've noticed that if I write an image via dd to a USB drive and then sha256sum that image; the sum changes. Why? It's never identical to that of the ISO.
I am running: sha256sum /dev/sdb (on the block device, not the partition(s))
|
If your image is smaller than the USB drive then you need to make sure you read back just that size of data from the drive, otherwise all the remainder of the drive will be added into the sha256 and create a different result.
e.g.
$ ls -l tst.iso
-rw-r--r... | Why does SHA 256 sum change when writing image to a drive? |
1,382,691,864,000 |
I know that on Linux (at least debian) every password are hashed and stored in /etc/shadow.
However thanks to the libpam-cracklib you can add some rules on passwords. For instance in /etc/pam.d/common-password you can set Difok which is a parameter that indicate the number of letter that can be the same between an old... |
When you ask a PAM module to change a password (or participate in changing a password), the module can retrieve both the new password and the old, as given by the user: as Christopher points out, passwd asks for the old password as well as the new (unless you’re running it as root and changing another user’s password)... | How Linux can compare old and new password? |
1,382,691,864,000 |
Two files containing same song, both in M4A format, output two different results when I calculate their hashes:
md5sum
f149e2d2a232a410fcf61627578c101a new.m4a
ad26ed675342f0f45dcb5f9de9d586df old.m4a
They contain same number of bytes:
ls -l
-rw-rw-r-- 1 cdc cdc 2978666 Jun 26 19:49 new.m4a
-rwxrwxr-x 1 cdc cdc 297... |
The metadata as printed by exiftool is part of the file-data. I.e:
$ diff <(exiftool old.m4a) <(exiftool new.m4a)
2c2
< File Name : old.m4a
---
> File Name : new.m4a
18,19c18,19
< Create Date : 2020:12:31 18:13:30
< Modify Date : 2020:... | Two supposedly same M4A files are giving different hash results. Why? |
1,382,691,864,000 |
#!/bin/bash
cd /path-to-directory
md5=$(find . -type f -exec md5sum {} \; | sort -k 2 | md5sum)
zenity --info \
--title= "Calculated checksum" \
--text= "$md5"
The process of a recursive checksum calculation for a directory takes a while.
The bash script doesn´t wait until the process is finished it just moves to t... |
As written, it would be waited for. For a pulsating progress bar:
#! /bin/sh -
export LC_ALL=C
cd /path/to/dir || exit
{
md5=$(
find . -type f -print0 |
sort -z |
xargs -r0 md5sum |
md5sum
)
exec >&-
zenity --info \
--title="Checksum" \
--text="$md5"
} | zenity --progres... | Wait until md5sum command is completed |
1,382,691,864,000 |
I have a bunch of files and for each row there is a unique value I'm trying to obscure with a hash.
However there are 3M rows across the files and a rough calculation of the time needed to complete the process is hilariously long at 32days.
for y in files*; do
cat $y | while read z; do
KEY=$(echo $z | awk '{ pr... |
FWIW I think this is the fastest way you could do it in a shell script:
$ cat tst.sh
#!/usr/bin/env bash
for file in "$@"; do
while IFS='"' read -ra a; do
sha=$(printf '%s' "${a[1]}" | sha1sum)
sha="${sha% *}"
printf '%s"%s"%s"%s"%s"%s"%s"\n' "${a[0]}" "$sha" "${a[2]}" "${a[3]}" "${a[4]}" ... | Concurrency of a find, hash val, and replace across large amount of rows |
1,382,691,864,000 |
I want to delete same file with different names scattered in folders.
This command works fine for searching and listing the files.
Then I manually delete the files.
Is it possible to add delete option to the below command ?
find /folder -type f -exec md5sum {} + | grep '^aafa26a6610d357d8e42f44bc7e76635'
|
try
find ... | awk '{$1 = "rm" ; print } ' | bash
this will replace actual md5sum (aaf...) by rm.
this will not work if filename have a special character in it, neither if file is write protected (replace rm by rm -f ).
| Find files based on MD5 and delete |
1,382,691,864,000 |
I am storing some multi-GB files on two hard drives. After several years in offline storage (unfortunately in far from ideal conditions), I often get some files with bit-rot (the two copies differ), and want to recover the file. The problem is, the files are so big, that within the same file, on some storage devices... |
I am not offering a complete solution here, but rather I'm hoping to be able to point you along the way to building your own solution. Personally I think there are better tools, such as rsync, but that doesn't seem to fit the criteria in your question.
I really wouldn't use split because that requires you to be able t... | How to separately checksum each "block" of a large file |
1,382,691,864,000 |
I have been using md5deep for a very long time, more than 10 years. It is a natural "go to" tool for me since it offers recursion, matching and missing modes, and even a triage which I do like.
I know about and have used the newer tool, hashdeep and have both installed on at least one machine.
I noticed I had differi... |
According to /usr/share/doc/hashdeep/README.md.gz, it's all one executable that acts differently depending on the name of the called program. If the program is called md5deep, it acts like md5deep.
I don't use it myself, but if I'm reading the docs right, you should be able to create a symlink to it that will produce... | how to bring back md5deep |
1,382,691,864,000 |
With the commands md5sum, sha1sum, sha256sum I can take a text file having an hash and a path per line and verify the entire list of files in a single command, like sha1sum -c mydir.txt. (Said text file is easy to produce with a loop in find or other.)
Is there a way to do the same with a list of CRC/CRC32 hashes?
Suc... |
Try RHash
Try RHash.
There are packages for
Cygwin, Debian.
Example
$ echo -n a > a.txt; echo -n b > b.txt; echo -n c > c.txt
✔
$ rhash --crc32 --simple *.txt > checksums.crc32
✔
$ cat checksums.crc32
e8b7be43 a.txt
71beeff9 b.txt
06b9df6f c.txt
✔
$ rhash --crc32 --check checksums.crc32
--( Verifying checksums.c... | Command to verify CRC (CRC32) hashes recursively |
1,382,691,864,000 |
I have a ext3 filesystem on a .img file. After mounting and unmounting it, I noticed that the md5sum is changed, even if no file inside was changed!
md5sum myfilesystem.img
XXXX myfilesystem.img
mount -t ext3 myfilesystem.img temp/
umount temp/
md5sum myfilesystem.img
YYYY myfilesystem.img
Why does XXXX differs from ... |
Because, if you mount the ext3 in writable mode, there are a few things that get updated, like the last mount date. Try if this also happens when you mount with -o ro.
| md5sum change after mount? |
1,382,691,864,000 |
I have a .deb file and its SHA1 checksum information.
How do I check the .deb file's authenticity using this checksum before installing?
There's many entries on Google for "how to verify checksums for installed packages" which is mind-boggingly useless yet none for checking BEFORE installing. Bonus points if you can e... |
To check whether your package matches the SHA1 sum you have, run
sha1sum /path/to/package.deb
and compare the output.
If you have the sum in a file of the form
sum package.deb
you can run sha1sum -c shafile to check the sum directly.
To determine the authenticity of the package, you’ll need to determine the authent... | SHA1 verification of external deb package before install |
1,382,691,864,000 |
I'm trying to write a bash script which, among several other things, will "log in" as a user (preferably with su if possible) without needing to interact with the password prompt, i.e., will automatically input the password. I only need it to perform one command and then the session can end.
This is for an "automati... |
if you have root :
salt=$(awk -F\$ '$1 ~ /student:/ { print $3 }' /etc/shadow)
hashedpasswd=$(awk -F: '$1 == "student" { print $2} ' /etc/shadow)
expected=$(mkpasswd -m sha-512 given-passwd $salt)
if [ "$hashedpasswd" = "expected" ]
then
echo good
else
echo bad
fi
replace student by revellant string of course.... | Automatically verify passwords for classroom exercise? [duplicate] |
1,382,691,864,000 |
(From a novice's point of view)
The other day I was thinking about how a typical "passwd" command works in a LINUX OS. For example, when we type in "passwd", a prompt appears letting us type in our password, and then it saves that password wrapping up with cryptographic algorithms and then saves in /etc/shadow. So I c... |
You would use a slow, salted, secure hash function: key derivation function.
We use a hash function so that the password is hidden, no one can read it, not even the admin. Hashes can not be reversed. When the user logs in we hash there password-input, and compare with the stored hash.
Salting is to add a large random... | What encryption mechanism is used to store passwords in `/etc/shadow` in a typical Unix, such as Gnu/Linux? |
1,382,691,864,000 |
Sometimes I use an unreliable medium (flash) to store a good deal of data. To at least recognise bit flips I store a file with the md5sums alongside. This file is usually created by a variation of find -type f -exec "{}" \; >MD5SUM. Later I copy some more files on it and now I would like to add the checksums of the ne... |
If this is going to be an on-going process, then you'll need two files, the old and new (which would become the old for next time).
#!/bin/sh
# change directory to either first argument or to current directory
cd ${1:-"."} || exit 1 # if cannot cd, then exit
# get the md5 values for all the files in the directory tree... | How do I easily update list of md5sums? |
1,382,691,864,000 |
I have been using Argon2 in my terminal (Debian), but I keep messing up, and I have been unable to find the manual or any other documentation that lists examples of commands that work.
Could someone give me a basic rundown of what the most important commands are? Or point me to a good reference?
I have the usage righ... |
You can run:
echo -n "hashThis" | argon2 saltItWithSalt -l 32
which will give you an output like with multiple lines of information about the resulting hash.
To get a one-line return of the same information encoded into a single argon2 string, you can add -e at the end. If you just want the raw bytes, use -r instead ... | Argon2 Commands in the Terminal |
1,382,691,864,000 |
Is there a hash-based filesystem, where:
There is a store of blocks (perhaps 512b, 4KB or 128KB) indexed by the hash of their contents.
Each block has a usage count. When it reaches zero, the block's storage is freed.
Files are just a length and a list of the block hashes.
This would enable many optimisations, such... |
It sounds like you're talking about a copy-on-write filesystem with deduplication. Both ZFS and Btrfs work like this to some degree. Btrfs has offline deduplication tools that can merge duplicate blocks some time after they've been written. ZFS can do online deduplication.
Is online deduplication a good idea? It d... | Hash-based filesystem? |
1,382,691,864,000 |
I'm trying to pass an MD5 password to chpasswd but it doesn't seem to work.
echo username:$(openssl passwd -1 -salt salt password)
Then I try to pass this to chpasswd to change the password
echo 'username:$1$salt$aldkjflsfj' | /usr/sbin/chpasswd -e
However, when I do this the password change does not seem to take e... |
The arguments must be quoted, else the shell validates special characters inside those arguments:
echo "username:"$(openssl passwd -1 -salt "$salt" "$password")
Use double quote here, that the shell evaluates the variables.
Now, the echo command must be quoted too:
echo 'username:$1$salt$aldkjflsfj' | ...
Use single... | chpasswd and openssl |
1,382,691,864,000 |
This question is very much related to this one.
I want to log into a user and password protected wifi which uses PEAP and maybe MS-CHAPv2. My wpa_supplicant.conf has to contain an entry like this:
network={
ssid="<somessid>"
key_mgmt=WPA-EAP
eap=PEAP
identity="<someidentity>"
password="<somepasswo... |
No, you cannot replace the password by a hash. It doesn't matter what the protocol is. The client needs to know the password, and then either it sends the password to the server, or it sends some data that proves that the client knows the password. The server can be content to know the hash of the real password, becau... | Store password as hash in wpa_supplicant.conf? [duplicate] |
1,591,870,767,000 |
I am dealing with transferring large files from one machine to another (600GB+) and I'm tarring them up using
tar -cpvzf file.tar.gz -C PATH_TO_DIR DIR
Once finished with the tarring process, the following is done:
split -d -b 2G file.tar.gz file_part_
This creates a bunch of file_part_00, file_part_01, ... until th... |
The problem was solved by adding additional storage space. To be specific, I added a 2TB hdd which is used to hold the tar while it's split on it. Originally, the whole process was done on a 6TB hdd with other large files on it giving us at most 3TB storage space to work with. The issue was noticed when we had somethi... | Failing to untar |
1,591,870,767,000 |
Do MD5 checksums contain a checkbit?
I have to copy some MD5 checksums by hand (there's no other way) and was wondering whether there is any code out there that can validate a checksum as being valid in the same way one can validate a credit card number.
Just to be clear, I'm not asking how to generate an MD5 sum from... |
Basically, it does not have any checksum bit. To identify a typo, you might try sharing an a checksum (for example, MD5) of your MD5 sum over the same channel and check it.
| Sanity checking MD5 sums |
1,591,870,767,000 |
I am trying to validate a file using the following command:
$ md5sum myfile_v2.1.ova -c myfile_v2.1.md5
md5sum: myfile_v2.1.ova: no properly formatted MD5 checksum lines found
myfile_v2.1.ova: OK
The exit status code seems to be 1
$ echo $?
1
However when reading the help for the md5sum command, strict mode (which ... |
The correct way to verify checksums in an MD5 checksum file is
$ md5sum -c file.md5
In your case:
$ md5sum -c myfile_v2.1.md5
This will read the pathname and checksums in the MD5 file and check them against the corresponding files on disk.
Your command line:
md5sum myfile_v2.1.ova -c myfile_v2.1.md5
This is equiv... | md5sum warning about formatted lines |
1,591,870,767,000 |
I am running my below shell script on machineC which gets the md5sum of my files in my PRIMARY directory in machineC itself.
#!/bin/bash
export PRIMARY=/data01/primary
for entry in "$PRIMARY"/*
do
local_md5sum=$(/usr/bin/md5sum "$entry" | awk '{print $1}')
echo $local_md5sum
done
As soon as I run above shel... |
I have modified your script and this one works now. I have added some comments inside the script to make it more understandable. Let me know if you need more help.
#!/bin/bash
#The export path which we set here.
export PRIMARY=/home/ramesh
#The main for loop execution starts here.
for entry in "$PRIMARY"/*
do
... | How to find md5sum of files on remote machines by doing ssh? |
1,591,870,767,000 |
I was looking at my companies hashing implementation and I saw that the passwords for the root user are stored in base64 encoding. What is to stop anyone from simply copying the password and doing a base64 -d on it? Or for someone to do the same thing to any other base64 password?
Am I missing something here?
|
A hash isn't an encoding, it's a non-reversible mathematical transformation. You can't take a hash and reverse the calculation to find the original value: you can only try brute-forcing a hash by trying passwords and hashing them to see if the hash matches.
Passwords are typically stored as a base64-encoded, salted ha... | What is the point of hashing? |
1,591,870,767,000 |
I was wondering:
Is it possible to create a checksum of a directory (using something like md5sum)
Is it possible to recursively create checksum for each file inside the dir (and then print it out)?
Or both?
I'm using bash
|
md5sum won't take directory as input, however
tar cf - FOO | md5sum
will checksum it, if a file is change any place within FOO, checksum will change, but you won't have any hint of which file. The checksum will also change if any file metadata changes (permissions, timestamps, …).
You might consider using :
find FO... | Get checksum of directory on bash |
1,591,870,767,000 |
I ran into a situation that I don't really understand. I have a bunch of backup files in a recursive structure of which I want to calculate the md5.
When I add some additional file extensions the process exits (exit code 0) without yielding any output.
find . -type f -iname "*.3gp" -o -iname "*.avi" -o -iname "*.mov" ... |
Let me first mention that -print0 is non standard and not the best solution. Better is to use "execplus", e.g.
find dir -type f -exec cmd {} +
Your main problem however is that the operators have precedence and your -print is "anded" with the last -name primary only.
So the right method is to put the -o red primaries... | find and md5sum not yielding any output (find -o limit?) |
1,591,870,767,000 |
I find it odd as I managed to get different md5sum using the exact same file from the same directory. The output as below:
[root@testlabs Config]# ls
Backup_Files
hostname1-config.uac
hostname2-config.uac
hostname3-config.uac
[root@testlabs Config]# ls hostname1-config.uac | md5sum
2a52f0eb11f6478a4f8aeee1... |
The response FAILED open or read happens when the file specified in the md5 checksum file (md5sum.tmp in your case) does not exist.
For example.
[user@localhost tmp]$ cd /tmp/testfolder
[user@localhost testfolder]$ touch dog
[user@localhost testfolder]$ md5sum dog > /tmp/md5sum.tmp
[user@localhost testfolder]$ md5sum ... | Different MD5Sum for the same file in same directory |
1,591,870,767,000 |
I'm using this command to rename files with random characters from sha1sum and move all files from subdirectories to the current directory:
for fname in `find . -type f`; do mv "$fname" $(echo "$fname" | sha1sum | cut -f1 -d' ').html; done
But the question is: Does it create unique filenames? I'm worried the generat... |
sha1sum outputs will be unique as long as inputs are unique.
(Unless you are very extremely unlucky and you found some sha1sum collision).
As for your use case: It's a good habit to use printf '%s' "$fname" instead of echo "$fname", the former will work when $fname is -n, or -e,… See also enzotib remark, I missed that... | Rename files with random characters from sha1sum. Will the names be unique? |
1,591,870,767,000 |
In AIX system (v 7.1) sha1sum is calculating different hash codes when its piped directly to the output of tar compared to when it reads a file.
What are the reasons for this ? Are there ways to workaround this and get the hash code directly from the tar piped output ?
(In others systems like Debian and Ubuntu, pipe... |
The reason for that problem is the command tar. It has internal records made of a fixed number of 512 bytes blocks. The number of blocks per record can be set with the parameter -b.
Some implementations can adjust the amount of blocks automatically according to the file descriptor, if its a tape device, a regular fil... | Different hash code when piping "sha1sum" to "tar" output |
1,591,870,767,000 |
I'm learning about SHA1 (specifically wrt Git), and I wanted to sanity-check my understanding by calculating a string's SHA1 with different methods - I expected identical SHA1 hashes, but instead I got distinct results from three of four methods:
>git hash-object --stdin <<< "Apple Pie"
23991897e13e47ed0adb91a0082c31c... |
The differences don't come from SHA1, but the input. The here-string syntax appends a newline, as we can see with od:
$ od -c <<< foo
0000000 f o o \n
So in your git command the input is the ten characters Apple Pie\n.
In addition, the double quotes you used in the here-strings don't support backslash escapes... | Different methods to get SHA1 give different results |
1,591,870,767,000 |
I have a series of gzip files which I wish to store more efficiently using xz, without losing traceability to a set of checksums of the gzip files.
I believe this amounts to being able to recreate the gzip files from the xz files, though I'm open to other suggestions.
To elaborate... If I have a gzip file named target... |
This may be helpful: https://github.com/google/grittibanzli
Grittibanzli is a tool to compress a deflate stream to a smaller file, which can be decoded to the original deflate stream again. That is, it compresses not only the data inside the deflate stream, but also the deflate-related information such as LZ77 symbols... | Can I recreate a gzip file exactly, given the original uncompressed file? |
1,591,870,767,000 |
I'm trying to apply SHA256 and then Base64 encode a string inside a shell script. Got it working with PHP:
php -r 'echo base64_encode(hash("sha256", "asdasd", false));'. But I'm trying to get rid of the PHP dependency.
Got this line that works well in the terminal (using the fish shell):
$ echo -n "asdasd" | shasum -a... |
The problem is that you are using different shells. The echo command is a shell builtin for most shells and each implementation behaves differently. Now, you said your default shell is fish. So, when you run this command:
~> echo -n "asdasd" | shasum -a 256 | cut -d " " -f 1 | xxd -r -p | base64
X9kkYl9qsWoZzJgHx8UGrh... | Apply SHA256 and Base64 to string in script |
1,591,870,767,000 |
I would be glad if someone could explain the meaning of qemu-img check <filename> command. Man pages provide very poor information about it:
check [-f fmt] [-r [leaks | all]] filename
Perform a consistency check on the disk image filename.
If "-r" is specified, qemu-img tries to repair any inconsiste... |
It is like a check disk on a physical file that constitute your virtual disk.
See the part: Only the formats "qcow2", "qed" and "vdi"
This mean that your virtual disk can be corrupted, wrong byte or missing data somewhere etc. Those formats seem to support some kind of checking and error correction, and that's the ... | What is qemu-img consistency check? |
1,591,870,767,000 |
I started noticing some time ago in Xfce4 that when I sent some file to the Trash, tumbler (the Xfce4 thumbnailer) would cause very high I/O load for quite some time. Upon investigating the issue, I found that it was scanning the ~/.thumbnails directory, which was very large in size.
So I decided to write a cron scrip... |
The NUL character is not included when the MD5 is calculated. Rather, it's the space character that's causing your problem. The filename is URL-encoded:
$ printf '%s' 'file:///home/teresaejunior/File%2001.png' | md5sum
a8502be3273541e618b840204479a7f9 -
Here's one way to do the conversion with Perl:
$ perl -MURI::... | How to compute a thumbnail filename from the shell? |
1,591,870,767,000 |
md5suming a file is fine, but I cannot seem to invoke md5sum to calculate the hash based only on the file's contents. (For those wondering, I'd prefer that multiple wgets of the same file return the same md5 hash. md5summing the file keeps reporting different hashes because the timestamp on the file is different.)
jul... |
Md5sum and other hashing functions have nothing to do with the timestamp of the file for which the checksum is being calculated. Unless you have some weird version installed it processes only the contents of the file.
| Running md5sum on a file's contents |
1,591,870,767,000 |
I have problem on Unix, have to create a lot of passwords in smd5 but don't know how to generate smd5 passwords using some unix tool or perl in a form:
{smd5}DoZgZ.OE$vSg4ZH7Bpy0BCdXNzBj001
I have never had any problems to generate anything on linux in md5/sha256/sha512 with tools like e.g. openssl
I have tried with ... |
AIX's {smd5} format is a non-standard one. It's a minor variant of the *BSD/Linux/Solaris “MD5” (which is the one generated by openssl passwd -1). I wasn't able to find much information about it. There is code contributed to John the Ripper (present in the 1.8.0 jumbo version) that calculates it, in the file aix_smd5_... | smd5 - generate by unix tool or perl |
1,591,870,767,000 |
I want to replace all files in a target path with the same name as original.file AND the same hash as orignal.file with new.file. What's the command to do this?
Say I have updated the contents of a file, and now I want all other copies of that file in a certain path to be updated as well.
In most cases the following c... |
This this will require a test to see if the checksums match before decide to run the cp, you will have to run a subshell as the -exec argument to find. This should do the job:
find /target_path/ -iname "original.file" -exec bash -c \
'[[ $(md5sum "original.file") = $(md5sum "{}") ]] && cp "new.file" "{}"' \;
| Replace all files with identical hash |
1,591,870,767,000 |
The command
ssh-keygen -lf /etc/ssh/ssh_host_rsa_key.pub
prints the 128-bit fingerprint of the RSA key.
What is the command to get the 160-bit fingerprint of a RSA key?
|
The key fingerprint is a hash of the key material. In a public key file, the key material is the second whitespace-separated field on the line, encoded in base64. The display format for the fingerprint depends on the hash that's being used.
The 128-bit fingerprint uses MD5 and is displayed in hexadecimal. For example,... | 160-bit fingerprint of RSA key |
1,591,870,767,000 |
I create a .tgz/tarball with $(npm pack).
I then run:
sha1sum oresoftware-npp-0.0.1001.tgz
and I get:
77c58da68593dcdcd14bb16a37f5f63ef42bab63 oresoftware-npp-0.0.1001.tgz
I want to compare that shasum against another tarball on a remote server.
I can query for a shasum for a tarball on the NPM registry, with:
np... |
The checksums available from the NPM registry provide two features: they allow you to verify that your download hasn’t been corrupted, and if you can verify the checksums out of band, that the downloaded files haven’t been altered. Unless NPM archives are built reproducibly, the checksums don’t allow you to verify tha... | Compare tarballs with sha1sum |
1,591,870,767,000 |
I'm trying to reverse engineering an IP camera firmware and found the complete ROM OS but I would like to find out the system password so I have looked at /etc/passwd.
The file is not there, it is instead in /etc/default/passwd and here is its content:
# cat passwd
admin:hgZXuon0A2DxN:0:0:Administrator:/etc/config:/bi... |
In that form (that is before /etc/shadow and without any $...$ prefix) it is probably (3)DES based hashing, see https://en.wikipedia.org/wiki/Crypt_%28C%29#Traditional_DES-based_scheme and the table above that paragraph:
The original password encryption scheme was found to be too fast and thus subject to brute force ... | Reverse engineering IP camera firmware to find admin password |
1,591,870,767,000 |
I went to the MX Linux website and their "Direct Download" linked me to their Sourceforge downloads page. I selected the first option - MX-19.2_September_x64.iso then checked the download using this utility.
MX website lists this -
Checksums and signatures of Final ISOs
MX-19.2_386.iso
md5sum: 6f5b12f9147bf457286e271... |
You are doing it right! Here is what I got for MX-19.2_September_x64.iso from the "Snapshots" directory:
$ md5sum MX-19.2_September_x64.iso
e1c424823243b3b5371953b22bc2307c MX-19.2_September_x64.iso
$ sha256sum MX-19.2_September_x64.iso
340ed960ac91e6c52f845278a4f2b751af7ce458f8ba126a3076564b5f8b1cef MX-19.2_Septemb... | MX Linux ISO checksum mismatch |
1,591,870,767,000 |
I need to write websocket server on GAWK. And server must handle user's Sec-WebSocket-Key by following algorithm (from RFC):
Concat key with 258EAFA5-E914-47DA-95CA-C5AB0DC85B11
Take sha-1 in binary form (should have 20 symbols)
Take base64 from that binary form
I'm trying to use openssl but the resulting code is in... |
The here string construct <<<… feeds the given string plus a newline as input to the command. So openssl sha1 -binary <<< 'a0+ZvgYqsMFHRerif0go8g==258EAFA5-E914-47DA-95CA-C5AB0DC85B11' is equivalent to
printf '%s\n' 'a0+ZvgYqsMFHRerif0go8g==258EAFA5-E914-47DA-95CA-C5AB0DC85B11' | openssl sha1 -binary
But your specifi... | Openssl generate invalid websocket security code |
1,591,870,767,000 |
I'm trying to install docker with apt from the https://download.docker.com/linux/debian/ repo.
Unfortunately installation always fails with a hash mismatch warning. I have already tried everything suggested in this post https://askubuntu.com/questions/41605/trouble-downloading-packages-list-due-to-a-hash-sum-mismatch-... |
Thanks @muru for referring to this post, it was indeed a problem with Windows' hyper-v and VirtualBox. Disabling the hyper-v acceleration solved the problem.
| VirutalBox: apt download / hashing problem (APT Hash Sum Mismatch) |
1,591,870,767,000 |
I have the following XML piece:
<value id="1" creatorId="0" creationTime="1639487132" expirationTime="1639573532">+380554446363</value>
<value id="1" creatorId="0" creationTime="1639487132" expirationTime="1639573532">+380554446364</value>
<value id="1" creatorId="0" creationTime="1639487132" expirationTime="163957353... |
The sha1sum is evaluating the SHA-1 of the constant string "\\1" instead of the first SED regex match:
$ echo \\1 | sha1sum
cbcac786fef5abeb39fe473ab6abe554978a8156 -
The shell performs all the various expansions (e.g. command substitutions) before executing the command (in this case, sed). Thus, shell expands
cat t... | Problems with replacing XML tag contents using sed |
1,591,870,767,000 |
I have a command that I run in a folder that outputs MD5 hashes and filenames on the terminal:
ls |sort -nr | xargs md5sum
I need this output in a text file that I can download and compare to another folder on another customer's machine. How can I modify the command such that its output is stored in a file in say /tm... |
It's a bad idea to parse the output of ls. The primary job of ls is to list the attributes of files (size, date, etc.). The shell itself is perfectly capable of listing the contents of a directory, with wildcards.
It's quite simple to run md5sum on all the files in the current directory and put the output in a file: r... | How do I redirect command output to a file? |
1,591,870,767,000 |
Input text: test
Online MD5 hashsum generator: 098f6bcd4621d373cade4e832627b4f6
echo "test" | md5sum: d8e8fca2dc0f896fd7cb4cb0031ba249
Also the same happens to sha512sum and sha1sum.
Why does Linux and an online generator generate different hashes?
|
One of these is the hash of "test" and one of them is the hash of "test\n".
$ printf 'test' | md5sum
098f6bcd4621d373cade4e832627b4f6 -
$ printf 'test\n' | md5sum
d8e8fca2dc0f896fd7cb4cb0031ba249 -
echo outputs a newline character after its arguments.
| Command line generates different hashsum than online hash generator… [duplicate] |
1,591,870,767,000 |
Is there a way I could get the md5 hash of a file on a remote server?
I'm looking for a command like
md5 hlin117@server:/path/to/file.txt
|
AFAIK there is no remote md5.
The closest you can get is to execute the command on the remote server:
ssh hlin117@server md5sum /path/to/file.txt
Obviously, md5sum must be installed on the remote server.
Alternatively, get the file and do it locally:
scp hlin117@server:/path/to/file.txt .
md5sum file.txt
rm file.txt
... | BASH: Getting the md5 hash of file on remote server |
1,591,870,767,000 |
I am given a file containing the md5 values for files within the same folder. The information is in the file md5checksums.txt in the following format:
b0da7ead9d82a3494d7e0a7099871ef4 ./GCF_000959505.1_ASM95950v1_assembly_report.txt
7ff32cbb16daf46c87b3546ad576ff66 ./GCF_000959505.1_ASM95950v1_assembly_stats.txt
034... |
I'm a bit confused as to why you involve awk in this.
To verify the MD5 checksums in a file produced by GNU md5sum, you do
md5sum -c file.txt
Or, on an OpenBSD or NetBSD system whose md5 utility supports -c filename (not FreeBSD or macOS):
md5 -c file.txt
In your case, file.txt would be your md5checksums.txt file.
| awk inside another awk's system |
1,591,870,767,000 |
I want output like this: name size and hash:
myfile.txt 222M 24f4ce42e0bc39ddf7b7e879a
mynewfile.txt 353M a274613df45a94c3c67fe646
For name and size only I have
ll -h | awk '{print $9,$10,$11,$12,$5}'
But how can I get hash for every file? I tried:
ll -h | awk '{print $9,$10,$11,$12,$5}' | md5sum
But I get only one... |
You should not parse ls, instead use this:
for f in * .*; do
[ -f "$f" ] && \
printf "%s %s %s\n" "$f" $(du -h -- "$f" | cut -f1) $(md5sum -- "$f" | cut -d' ' -f1)
done
The for loop runs trough all files and directories in the current directory.
[ -f "$f" ] checks if it's a regular file
printf "%s %s %s\n" p... | md5sum for every file (with ll) |
1,652,101,680,000 |
I have a big log file containing a line as below example :
{"data_1":210,"target_number":1096748811,"extra_data":66}
{"data_1":0,"target_number":7130881445,"extra_data":56}
{"data_1":1712,"target_number":1098334917,"extra_data":48}
{"data_1":0,"target_number":3062674667,"extra_data":54}
{"data_1":53,"target_number":51... |
jq does not have direct md5 calculation function like it has for base64. You need to use the shell's utilities for that.
jq -c . input.log |
while IFS= read -r obj; do
md5sum=$( printf '%s' "$obj" | jq -j '.target_number' | md5sum | cut -d' ' -f1)
jq -c --arg md5 "$md5sum" '.target_number = $md5' <<<"$obj"
do... | How should I replace a value in JSON file with its md5 value using jq command? |
1,652,101,680,000 |
I am trying to calculate a PBKDF2 hash, but am getting inconsistent results.
Message: Hello
Salt: 60C100D05C610E8B94A854DFC0789885
Iterations: 1
Key length: 16
Expected hash: 584519EF3E56714E301A4D85F972B6B4
nettle-pbkdf2 gives a951d3cd9014e0c0 527000727c1e928a
https://asecuritysite.com/encryption/PBKDF2z and Crypt... |
nettle-pbkdf2 documents it uses HMAC-SHA256 as its pseudo-random function; the other two are using HMAC-SHA1. Nettle has a PBKDF2-HMAC-SHA1 implementation, but I'm not sure if you can easily get it from the command line. (HMAC-SHA256 is generally a better choice if you have the option; SHA1 should be avoided).
(Of cou... | PBKDF2 not the same |
1,652,101,680,000 |
I recently came across sha1sum -c . As the manpage states -
-c, --check
read SHA1 sums from the FILEs and check them
Now I know how to generate and use sha1sum from an .iso . For instance,
$ sha1sum grml64-full_2014.11.iso
120bfa48b096691797a73fa2f464c7c71fac1587 grml64-full_2014.11.iso
But if I try... |
Generate the sha1sum file,
sha1sum myfile >sums
Then check with this file,
sha1sum -c sums
| creating and using hashsum in .iso image |
1,652,101,680,000 |
Windows EXE files which are in the PE format have a header and it contains a checksum.
Is it possible to verify it under Linux?
Because I am looking for a Linux command I hope you understand that this is a Linux and not a Windows question (please don't close it).
|
There are a number of tools to do this; one such is pefile, a Python library with a build-in PE checksum verification function:
#!/usr/bin/python3
import pefile
import sys
pe = pefile.PE(sys.argv[1])
if pe.verify_checksum():
print("PE checksum verified")
else:
print("PE checksum invalid")
(error-handling le... | Is it possible to verify a Windows EXE (PE file format) checksum under Linux? |
1,652,101,680,000 |
I want to make a shell script, that lets the user select a mounted device and calculate a checksum for the whole data on this device. I need the checksum to test if the device has been manipulated by somebody else. My approach to this was like the following:
#!/bin/bash
cd "${0%/*}"
device=$(zenity --file-selection... |
You can use pv which allows you to monitor the progress of data through a pipe.
find "$device" -type f -exec md5sum {} \; | pv -ls $(find "$device" -type f |wc -l) | sort -k 2 | md5sum
-s <size> provides the total size of the data. Since we want to show the progress according to the number of files, to need to know ... | Calculate checksum for whole content of a device and add a progress bar |
1,652,101,680,000 |
I am get this same output after checking hashes of rmmod, modprobe, modinfo, modinfo, lsmod, insmod, depmod
root@user:/var/log/apt# md5sum /sbin/modprobe
150aa565f1e37e2fd200523b6b4fcedf /sbin/modprobe
root@user:/var/log/apt# md5sum /sbin/modinfo
150aa565f1e37e2fd200523b6b4fcedf /sbin/modinfo
root@user:/var/log/ap... |
I see this on my Ubuntu system:
$ ls -l /sbin/modprobe /sbin/modinfo /sbin/lsmod /sbin/insmod /sbin/depmod
lrwxrwxrwx 1 root root 9 Mar 12 09:15 /sbin/depmod -> /bin/kmod
lrwxrwxrwx 1 root root 9 Mar 12 09:15 /sbin/insmod -> /bin/kmod
lrwxrwxrwx 1 root root 9 Mar 12 09:15 /sbin/lsmod -> /bin/kmod
lrwxrwxrwx 1 root roo... | hashes are the same: rmmod, modprobe, modinfo, modinfo, lsmod, insmod, depmod |
1,652,101,680,000 |
I have a very large file (200GB). Apparently when I transfer it over it did not copy correctly. The sha1 hash on both are different. Is there a way I can divide the file up to blocks (like 1MB or 64MB) and output a hash for each block? Then compare/fix?
I might just write a quick app to do it.
|
That "quick app" already exists, and is relatively common: rsync. Of course, rsync will do a whole lot more than that, but what you want is fairly simple:
rsync -cvP --inplace user@source:src-path-to-file dest-path-to-file # from the destination
rsync -cvP --inplace src-path-to-file user@dest:dest-path-to-file #... | Hash a file by 64MB blocks? |
1,652,101,680,000 |
I'm comparing two USB devices post-rsync with md5sum /usb1/* /usb2/* | sort such that all the files, which are at the root of the drives, have their md5 sums calculated, then the output is sorted by md5sum. The entire command expands to md5sum /usb1/bigfile1 /usb1/bigfile2 /usb2/bigfile1 /usb2/bigfile2, for example. M... |
You can use progress for this:
progress -p $(pgrep md5sum)
or, if you want to continuously monitor md5sum:
progress -m -p $(pgrep md5sum)
Without using an external tool, you can see what files md5sum is currently accessing on Linux by listing /proc/$(pgrep md5sum)/fd, and find out more information about the file des... | md5sum progress when piped |
1,652,101,680,000 |
I have a file.bin and file.bin.sha. The file.bin.sha has 32 bytes and contains binary data. How can I verify the checksum? sha256sum complains about no properly formatted SHA256 checksum lines found.
|
Convert the 256-bit binary value to its hex ascii representation, and append the filename to create a check file that sha256sum will like:
echo $(od -An -tx1 file.bin.sha | tr -d '\n ') file.bin > my256
sha256sum -c my256
od - octal (binary, hex) dump of file
-An - suppress addresses
-tx1 - print as one byte values... | How to verify binary SHA checksum |
1,652,101,680,000 |
I am trying to write a script and it uses the SHA of a date but I am getting two different results and for the life of me can't figure out why.
echo -n 03112016 | cut -d'.' -f4 | sha256sum | cut -d' ' -f 1
482c00f7db8419d9f9a151d54de301d73c8f688b2e3e91c485f369596543612e
date "+%m%d%Y" | tr -d '\n' | sha256sum | cut -... |
Shell utilities that are designed to operate on text (such as cat, cut, sort, tail, etc.) require their input to be text files. A text file, in Unix terms:
consists only of valid characters in the ambient locale (LC_CTYPE locale setting), other than the null byte;
consists of a sequence of lines, each of which is ter... | Why don't the SHA's match? |
1,652,101,680,000 |
I'm having some difficulty using md5sum to verify some copied files.
I have two directories: dir1 and dir2. In dir1 there are five files: file1, file2, file3, file4 and file5. dir2 is empty.
If I do: cp dir1/* dir2,
then: md5sum dir1/* > checksums,
then: md5sum -c checksums,
the result is:
dir1/file1: OK
dir1/file2: ... |
Try:
$ (cd dir1 && md5sum *) > checksums
$ cd dir2
$ md5sum -c ../checksums
checksums's content would look like:
d41d8cd98f00b204e9800998ecf8427e file1
................................ file2
................................ file3
................................ file4
................................ file5
| Difficulty using 'md5sum -c' |
1,652,101,680,000 |
I am running my below shell script which gets the md5sum of a files in my PRIMARY directory
#!/bin/bash
export PRIMARY=/data01/primary
for entry in "$PRIMARY"/*
do
local_md5sum=/usr/bin/md5sum "$entry" | awk '{print $1}'
echo local_md5sum
done
As soon as I run above shell script and try to print out the md... |
You're missing some syntax on this line:
local_md5sum=/usr/bin/md5sum "$entry" | awk '{print $1}'
You need
local_md5sum=$(/usr/bin/md5sum "$entry" | awk '{print $1}')
Without the $(), you are trying to execute $entry as a command.
| Permission denied while getting the md5sum of a file using shell script? |
1,652,101,680,000 |
I am using sha256sum to check whether file has changed or not within the bash script. My idea is to first store the sha256sum in a *.sha256 file. Then if this is present then use this for sha256 comparison using --check command. If hashes match then continue the rest of script otherwise create new hash file (*.sha256)... |
From the comment:
But the script uses set -Eeo pipefail
set -e causes the whole script to fail if and when sha256sum --check exits with a falsy status. To avoid that, put the command in any sort of conditional, e.g. run sha256sum --check || true instead.
Also, as mentioned, s1=$(sha256sum "$x" > "$x.sha256") looks a... | How to compare hashes of files in bash script? |
1,652,101,680,000 |
I am trying to count occurrence of each word on particular line of input. Given example (what I am trying to achieve):
$./foo.pl
asd fgh
asd iop
zxc
asd: 1, 2
fgh: 1
iop: 2
zxc: 3
Just a program to record, on which line a word occurred.
This script:
#!/usr/bin/perl -w
while(<>){
++$line_num;
@words = split $... |
As noted in Rakesh Sharma's comment, the syntax for accessing an anonymous array as an element of a hash is @{ $h{$w} }. So for example:
#!/usr/bin/perl -w
while(<>){
for my $w (split) {
push @{ $h{$w} }, $.;
}
}
for my $k (keys %h) {
print "$k:\t", "@{ $h{$k} }\n";
}
See for example
Hash of Arr... | How to implement string to array hash in perl? |
1,652,101,680,000 |
I'm having a problem checking certain .md5 files, they are all files that are in directories which have been renamed since the files were downloaded.
[User1 Directory X]$ md5sum -c file1.txt.md5
md5sum: directoryx/file1.txt: No such file or directory
directoryx/file1.txt: FAILED open or read
md5sum: WARNING: 1 listed ... |
It seems (from your prompt) that the file is located in the correct directoryx, but since md5sum will try to read the file at the path given by the .md5 file, and since you are in directoryx, it won't find it.
Move one level up in the directory hierarchy and use
$ md5sum -c directoryx/file1.txt.md5
| md5sum failed to open a file, directory issue |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.