md5-hash-from-file

command
v0.0.0-...-a2a1f02 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 1, 2020 License: MIT Imports: 7 Imported by: 0

README

md5-hash-from-file example

Getting an md5 hash (fingerprint) from an input file using the standard crypto/md5 package. I also added a flag to read in your .ssh/id_rsa.pub key to get your ssh fingerprint. Your github uses this for verification.

Refer to the crypto/md5 package for more info.

GitHub Webpage

RUN

go run md5-hash-from-file.go <FILENAME>
go run md5-hash-from-file.go test.txt

If you run on test.txt you should get,

950dc9055bc2eb9b1f143e92d7bee6c4

HOW IT WORKS

Take a string plainText and turn into a md5 hash,

plainTextBytes := []byte(plainText)

// HASH
md5HashByte := md5.Sum(plainTextBytes)

// CONVERT TO STRING
md5Hash := hex.EncodeToString(md5HashByte[:])

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL