Skip to content

Commit 3afb86b

Browse files
committed
Remove MD5, use SHA256
1 parent 7189a41 commit 3afb86b

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

ssh/client/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ func PromptPassword() (secret string, err error) {
5757
// PromptAcceptHostKey prompts the user to accept or reject the given host key.
5858
func PromptAcceptHostKey(hostname string, remote net.Addr, publicKey string) bool {
5959
for {
60-
fmt.Printf("Key fingerprint MD5 is: %s do you recognize it? (y/n) ", publicKey)
60+
fmt.Printf("Key fingerprint SHA256 is: %s do you recognize it? (y/n) ", publicKey)
6161
var answer string
6262
fmt.Scanln(&answer)
6363
answer = strings.ToLower(answer)

ssh/client/ssh/ssh.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package ssh
22

33
import (
4-
"crypto/md5"
4+
"crypto/sha256"
55
"fmt"
66
"io"
77
"io/ioutil"
@@ -291,7 +291,7 @@ func (client *Client) verifyHostKey(hostname string, remote net.Addr, key ssh.Pu
291291
case *knownhosts.KeyError:
292292
if len(e.Want) == 0 {
293293
// It's an unknown key, prompt user!
294-
hash := md5.New()
294+
hash := sha256.New()
295295
hash.Write(key.Marshal())
296296
if client.promptForForeignKeyConfirmation(hostname, remote, fmt.Sprintf("%x", hash.Sum(nil))) {
297297
newLine := knownhosts.Line([]string{remote.String()}, key)

0 commit comments

Comments
 (0)