Skip to content

Instantly share code, notes, and snippets.

@as
Created August 9, 2018 05:39
Show Gist options
  • Save as/15fdf059b7c55c0867601e6c69ad97d1 to your computer and use it in GitHub Desktop.
Save as/15fdf059b7c55c0867601e6c69ad97d1 to your computer and use it in GitHub Desktop.
"A challenge: to create a source code that contains a valid link to itself"
package main
import (
"crypto/sha256"
"encoding/base64"
"fmt"
"io"
)
var x = string(0x60)
func main() {
h := sha256.New()
io.WriteString(h, "Go playground salt\n")
io.WriteString(h, p)
io.WriteString(h, x)
io.WriteString(h, p)
io.WriteString(h, x)
sum := h.Sum(nil)
b := make([]byte, 10000)
base64.URLEncoding.Encode(b, sum)
fmt.Println("zerkms: A challenge: to create a source code that contains a valid link to itself")
fmt.Printf("@zerkms -> https://play.golang.org/p/%s", b[:11])
}
const p = `package main
import (
"crypto/sha256"
"encoding/base64"
"fmt"
"io"
)
var x = string(0x60)
func main() {
h := sha256.New()
io.WriteString(h, "Go playground salt\n")
io.WriteString(h, p)
io.WriteString(h, x)
io.WriteString(h, p)
io.WriteString(h, x)
sum := h.Sum(nil)
b := make([]byte, 10000)
base64.URLEncoding.Encode(b, sum)
fmt.Println("zerkms: A challenge: to create a source code that contains a valid link to itself")
fmt.Printf("@zerkms -> https://play.golang.org/p/%s", b[:11])
}
const p = `
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment