Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

jobetter23

macrumors newbie
Original poster
Nov 17, 2010
5
0
Hey guys, anybody know, via terminal, how to convert a file with many lines of e-mails into an md5 file and export it ito .txt file- if possible , not to delete the e-mails.
ex :
jojo@aol.com into

Jojo@aol.com, 60b4498f429ea861dhja7807ae69ec4a

any help will be great! :rolleyes:
 
What's the goal of what you are trying to accomplish? MD5 is a hashing algorithm. It's designed to show that the contents of two files are the same. So if you hash a file, it would have nothing do with deleting it. MD5 is not encryption.
 
Code:
$ [B]md5 -s jojo@aol.com[/B]
MD5 ("jojo@aol.com") = 8f6267dd59127998be428284e7ebee1e

Wrap that in a for loop and you're most of the way to what I think you want.

B
 
Ill try to make my goal more clear, sorry guys

What's the goal of what you are trying to accomplish? MD5 is a hashing algorithm. It's designed to show that the contents of two files are the same. So if you hash a file, it would have nothing do with deleting it. MD5 is not encryption.

This is my goal: somebody sends me a file of md5 encrypted e-mails. So i need to turn my own list of normal e-mails into MD5 so i can compare it with that md5 list that they send me.

So i want to input my entire list of regular e-mails (thousands of lines) and input it into terminal and have it return a new file of md5 names.

If there is an easier way to do this let me know
Thanks so much!!
 
Hey guys, anybody know, via terminal, how to convert a file with many lines of e-mails into an md5 file and export it ito .txt file- if possible , not to delete the e-mails.
ex :
jojo@aol.com into

Jojo@aol.com, 60b4498f429ea861dhja7807ae69ec4a

any help will be great! :rolleyes:

Code:
perl -MDigest::MD5 -n -E 'chomp($_); say(join(", ", $_, Digest::MD5::md5_hex($_)))'

Feed it the data on stdin, get the output on stdout.

Andrew
 
Code:
perl -MDigest::MD5 -n -E 'chomp($_); say(join(", ", $_, Digest::MD5::md5_hex($_)))'

Feed it the data on stdin, get the output on stdout.

Andrew

Sorry just a little new to this - where exactly am i supposed to insert the file (and the output), if u can tell me where exactly in the code.
Thanks!!
 
There are also alternative ways to do this in bash, (to expand on what balamw was suggesting).

Code:
while read line; do md5 -s "$line" ; done < emails.txt

This will take a text file with emails and dump the md5 checksums to stdout. You can also redirect the output to a new file if you want to.
 
Code:
perl -MDigest::MD5 -n -E 'chomp($_); say(join(", ", $_, Digest::MD5::md5_hex($_)))'

Feed it the data on stdin, get the output on stdout.

Andrew

Is there a way to add a line break in this code so that he first line of the stdout is a blank line?
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.