Skip to content

Instantly share code, notes, and snippets.

@hihumikan
Created April 26, 2024 15:04
Show Gist options
  • Save hihumikan/14e5c92094ed52b6048ddd91523d0cc7 to your computer and use it in GitHub Desktop.
Save hihumikan/14e5c92094ed52b6048ddd91523d0cc7 to your computer and use it in GitHub Desktop.
package main
import (
"crypto/sha256"
"encoding/hex"
"fmt"
)
func main() {
targetHash := ""
for i := 0; i <= 999; i++ {
// 0埋めして3桁の数字文字列を作成
numStr := fmt.Sprintf("%03d", i)
str := "HI2024_" + numStr
// 文字列をSHA256ハッシュに変換
hash := sha256.Sum256([]byte(str))
hashStr := hex.EncodeToString(hash[:])
// ハッシュの比較
if hashStr == targetHash {
fmt.Printf("Found matching hash for %s: %s\n", str, hashStr)
break
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment