adding 2015 & 2025 advents

This commit is contained in:
2025-12-16 21:34:25 +01:00
parent 536070e45c
commit 12892d6460
17 changed files with 6054 additions and 0 deletions

10
2015/04/golang/.vscode/settings.json vendored Normal file
View File

@@ -0,0 +1,10 @@
{
"[go]": {
"editor.insertSpaces": false,
"editor.formatOnSave": true,
"editor.defaultFormatter": "golang.go",
"editor.codeActionsOnSave": {
"source.organizeImports": "explicit"
}
}
}

3
2015/04/golang/go.mod Normal file
View File

@@ -0,0 +1,3 @@
module aoc/day-4
go 1.24.4

29
2015/04/golang/main.go Normal file
View File

@@ -0,0 +1,29 @@
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[:])
}