pow

package module
v0.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 29, 2021 License: BSD-3-Clause Imports: 7 Imported by: 1

README

redpwnpow

A non-parallelizable proof of work challenge system

Install

To download, cache, and execute a binary to solve a PoW challenge in a single command, use:

curl -sSfL https://pwn.red/pow | sh -s challenge

Static binaries for Linux, Windows, and macOS are also available in GitHub releases.

If Go and libgmp are available, you can compile, install, and run with:

go install github.com/redpwn/pow/cmd/redpwnpow@latest
redpwnpow challenge

kCTF

redpwnpow can be used as a drop-in replacement for kCTF's proof of work solver.

Go module

Go Reference

Challenge example
package main

import (
	"bufio"
	"fmt"
	"os"

	"github.com/redpwn/pow"
)

func main() {
	c := pow.GenerateChallenge(5000)
	fmt.Printf("proof of work: curl -sSfL https://pwn.red/pow | sh -s %s\nsolution: ", c)
	s, _ := bufio.NewReader(os.Stdin).ReadString('\n')
	if good, err := c.Check(s); err == nil && good {
		fmt.Println("good")
	} else {
		fmt.Println("bad")
	}
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Challenge added in v0.0.2

type Challenge struct {
	// contains filtered or unexported fields
}

func DecodeChallenge

func DecodeChallenge(v string) (*Challenge, error)

DecodeChallenge decodes a redpwnpow challenge produced by String.

func GenerateChallenge

func GenerateChallenge(d uint32) *Challenge

GenerateChallenge creates a new random challenge.

func (*Challenge) Check added in v0.0.2

func (c *Challenge) Check(s string) (bool, error)

Check verifies that a solution proof from Solve is correct.

func (*Challenge) Solve added in v0.0.2

func (c *Challenge) Solve() string

Solve solves the challenge and returns a solution proof that can be checked by Check.

func (*Challenge) String added in v0.0.2

func (c *Challenge) String() string

String encodes the challenge in a format that can be decoded by DecodeChallenge.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL