Skip to content

Instantly share code, notes, and snippets.

@erayaydin
Created September 18, 2023 13:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save erayaydin/bbcf26a07e7d2aadfec7b406710011d5 to your computer and use it in GitHub Desktop.
Save erayaydin/bbcf26a07e7d2aadfec7b406710011d5 to your computer and use it in GitHub Desktop.
package main
import (
"bytes"
"crypto/sha256"
"encoding/hex"
"fmt"
)
var (
_chars = [] byte("0123456789abcdef") _names = [] string {
"zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "a", "b", "c", "d", "e", "f"
}
_size = len(_chars)
)
func main() {
hexsum: = make([] byte, 64)
for i1: = 0;i1 < _size;i1++{
for i2: = 0;
i2 < _size;
i2++{
for i3: = 0;
i3 < _size;
i3++{
for i4: = 0;
i4 < _size;
i4++{
for i5: = 0;
i5 < _size;
i5++{
for i6: = 0;
i6 < _size;
i6++{
for i7: = 0;
i7 < _size;
i7++{
s: = fmt.Sprintf("The SHA256 for this sentence begins with: %s, %s, %s, %s, %s, %s and %s.", _names[i1], _names[i2], _names[i3], _names[i4], _names[i5], _names[i6], _names[i7])
sum: = sha256.Sum256([] byte(s))
hex.Encode(hexsum, sum[: ])
prefix: = [] byte {
_chars[i1], _chars[i2], _chars[i3], _chars[i4], _chars[i5], _chars[i6], _chars[i7]
}
if bytes.HasPrefix(hexsum, prefix) {
fmt.Printf("%s\n", s)
fmt.Printf("%s\n", hexsum)
}
}
}
}
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment