From ef25d5fcc73b9d0cd2a2ac69fdee9d7a2dbfa9ed Mon Sep 17 00:00:00 2001 From: Runxi Yu Date: Sun, 23 Mar 2025 10:44:47 +0800 Subject: Separate them into different files --- tmpl.go | 125 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 125 insertions(+) create mode 100644 tmpl.go (limited to 'tmpl.go') diff --git a/tmpl.go b/tmpl.go new file mode 100644 index 0000000..737e9c4 --- /dev/null +++ b/tmpl.go @@ -0,0 +1,125 @@ +package main + +import ( + "html" + "log" + "text/template" +) + +var tmpl *template.Template + +func init() { + var err error + tmpl, err = template.New("powxy").Parse(` + + + +Proof of Work Challenge + + +

Proof of Work Challenge

+

This site is protected by Powxy.

+

You must complete this proof of work challenge before you could access this site.

+{{- if .Message }} +

{{ .Message }}

+{{- end }} +

Select an nonce shorter than or equal to 32 bytes, such that when it is appended to the decoded form of the following base64 string, and a SHA-256 hash is taken as a whole, the first {{ .NeedBits }} bits of the SHA-256 hash are zeros. Within one octet, higher bits are considered to be in front of lower bits.

+

{{ .UnsignedTokenBase64 }}

+
+

+Encode your selected nonce in base64 and submit it below: +

+ + +
+
+
+Program to solve this +
` + html.EscapeString(solverProgram) + `
+
+

+ + + +`) + if err != nil { + log.Fatal(err) + } +} -- cgit v1.2.3