30 lines
396 B
Go
30 lines
396 B
Go
package main
|
|
|
|
import (
|
|
"crypto/md5"
|
|
"encoding/hex"
|
|
"fmt"
|
|
"strconv"
|
|
)
|
|
|
|
const key = "bgvyzdsv"
|
|
|
|
func main() {
|
|
i := 0
|
|
var found = false
|
|
for !found {
|
|
hash := genMD5Hash(key + strconv.Itoa(i))
|
|
if hash[0:6] == "000000" {
|
|
found = true
|
|
} else {
|
|
i += 1
|
|
}
|
|
}
|
|
fmt.Println(i)
|
|
}
|
|
|
|
func genMD5Hash(text string) string {
|
|
hash := md5.Sum([]byte(text))
|
|
return hex.EncodeToString(hash[:])
|
|
}
|