Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Dencryption of md5 string in Go

So I came across the following code in Go trying to explain how md5 hashing works.

package main

import (
    "crypto/md5"
    "fmt"
)

func HashFunc(word string) {

    hash := md5.New()
    bytes := []byte(word)

    hash.Write(bytes)
    hashValue := hash.Sum(nil)
    hashSize := hash.Size()

    for n := 0; n < hashSize; n += 4 {
        var val = uint32(hashValue[n])<<24 +
            uint32(hashValue[n+1])<<16 +
            uint32(hashValue[n+2])<<8 +
            uint32(hashValue[n+3])
        fmt.Printf("%x ", val)
    }
    fmt.Println()
}

I would simply like to know how to dencrypt any data that is encrypted by the above function.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

You don’t

MD5 is a hash function, not an encryption function. The point of a hash function is that it is impossible to covert the output back into the input

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading