Different hash when using file/openssl and online hasher - hash

I have a file, file.txt and inside it I have a text computer. When I use openssl to make a MD5 hash out of it, it gives me:
openssl dgst -md5 file.txt
MD5(file.txt)= 6accefe4a7ff62bd935f25a053c5fd3c
And when I use http://www.md5.cz/ to make hash from the word computer it gives me df53ca268240ca76670c8566ee54568a and I dont know why.
In my file theres no newlines and spaces. What is the problem here?

MD5 of computer is df53ca268240ca76670c8566ee54568a.
MD5 of computer\n is 6accefe4a7ff62bd935f25a053c5fd3c.
Your file.txt is having a new line character \n at the end.

Related

How to generate one hash key for a directory in PowerShell?

This is what I am doing on linux
cat a-directory/* | md5
What would be the alternative in PowerShell, maybe something with CertUtil?
The reason I am doing this is that I want to make sure I can copy a large directory.

SHA512 with salt encoding in powershell

I am trying to generate a SHA512 hash password string with salt encoding in powershell..
I found below python one and checked working fine
python -c 'import crypt; print crypt.crypt("welcome#123", crypt.mksalt(crypt.METHOD_SHA512))'
Is there anything similar in powershell...??

MD5Hash encrypt a list of emails via terminal for an outside vendor

I have a list of emails in a txt file that a vendor is requesting to be MD5Hash encrypted. From my understanding MD5Hash isn't an encryption so I'm unsure how to do this.
Is there a terminal command to take a txt file and MD5hash every single email in the file so it is "encrypted"?
The only terminal command I know regarding MD5hash and the result when I MD5hash the file is below:
MD5 -r /Users/Me/Desktop/test_file.txt
Result is:
0240da8148f06ae774de0831eda20eee /Users/Me/Desktop/test_file.txt
Anyone know of a method to (I guess) MD5hash every single email in the file? There are 20k emails, so doing each one individually isn't an option. Or am I misunderstanding how MD5Hash should be used for an email list? And FYI I'm using Terminal on a Mac.
Thanks!
I guess they don't want to transport plain text emails. Later they will compare hashes of their emails to your file.
For examle emails.txt:
a#a.com
b#b.com
c#c.com
d#d.com
Command that writes MD5-s of each e-mail to new file:
cat emails.txt | while read line; do echo -n $line|md5; done >> emailsMd5.txt
If you have a file containing comma separated emails:
cat emailsCommaSep.txt | perl -pe s/,/\\n/g | while read line; do echo -n $line|md5 done >> emailsMd5.txt
Sources:
How to create md5 hash in bash in Mac OS X
hash each line in text file

Decryption with gpg

gpg --output C:\ecshome\mboxes\store\20150410_030846_1_0001_6pik.msg.
asc --passphrase abcd. --no-default-keyring --decrypt C:\ecshome\mboxes\store\20150410_030846_1_0001_6pik.msg
When I try to decrypt an email message by using gpg from the command prompt, it works. But when I try to decrypt the same with a Perl script by using external command, it shows the "Secret key not available" error (On Windows).
You haven't shown us the way you quote that command in perl, but allow me guess that you haven't taken into account the fact that the backslash is both the Windows directory seperator and the Perl string escape. You should be aware that "\e", the 3rd character in your --output & --decrypt paths, is the character (ESC). The sequences "\m" and "\s" interpolate to 'm' and 's' respectively.
Possible solutions include either delimiting the string with q()/single quotes or doubling up the backslashes in qq()/qx()/double quotes/back quotes.
The problem was with pubkey ring. Apparently its stored for each user under their application data directory if you don't mention any home directory specifically at time of installation. If you execute from Command prompt it will directly take from the present user's applicatin data but from perl it wont check there.U have to specifically Configure GNUPGHOME to that folder (application data) then run the perl script.

sed task not working on macbook pro

I have not found a solution for the following stupid task.
I have a file whose complete path I denote with
file_name
and two strings which are stored in variables var1 and var2.
I know that the string in var2 is inside the file file_name. I want to find and replace all the occurrences of var2 in file_name with the string in var1.
These strings contain path names. This means I have the character / inside.
Furthermore my machine is a macbook pro.
Combining many suggestions found on internet I finally tried in a terminal
sed -i "" -e "s:$var2:$var1:g" file_name
Result: file_name does not change. Any suggestion?
Is there a solution with awk?
Macs use BSD sed, not GNU sed. BSD sed does not have the -i or --in-place option. You will have to write out to a temporary file, and then move the new file in place after it is written.