Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am trying to calculate the md5 hash of a string (say 'hunter5'). To do this, I run md5sum , type or paste the string, then type Control-D (EOT) twice.

> md5sum
hunter5ef6ea1eaa2e851d5d855f7773fc150af *-

The hash is printed on the same line as the original string, which makes it frustrating to copy and paste. Is there a better way?

I have this problem both in Windows and Linux.

share|improve this question
    
You are asking about the widows command line specifically? Or is this powershell? –  terdon Jul 11 '13 at 13:01
    
You're seeing your input printed back followed by the md5 checksum. Do it as Colonel Panic did below, using an echo and pipe it to md5sum command. –  Nasir Jul 11 '13 at 13:08

1 Answer 1

In Bash (Windows or Linux), this works

$ echo -n "hunter5" | md5sum
ef6ea1eaa2e851d5d855f7773fc150af *-

But beware! On cmd this gives the wrong answer

> echo "hunter5" | md5sum
466f34712f1c143c0a428275d714ad4c *-
share|improve this answer
2  
This is not the wrong answer. Have a look how echo "hunter5" is working in cmd: It prints the apostrophes, too! You also have to think about if newline \n or \r\n is included. –  mpy Jul 11 '13 at 13:10
    
What Colonel Panic was trying to say is that you need to send it to the pipe without newlines, otherwise, on (this) command, it produces the wrong sum (answer). –  BCable Jul 11 '13 at 13:34

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.