spam

package
v0.3.16 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Guard

type Guard struct {
	Difficulty int
	// contains filtered or unexported fields
}

Guard implements a spam protection mechanism for Cwtch Servers.

func (*Guard) GenerateChallenge

func (sg *Guard) GenerateChallenge(channelID int32) []byte

GenerateChallenge returns a channel result packet with a spamguard challenge nonce

func (*Guard) SolveChallenge

func (sg *Guard) SolveChallenge(challenge []byte, message []byte) []byte

SolveChallenge takes in a challenge and a message and returns a solution The solution is a 24 byte nonce which when hashed with the challenge and the message produces a sha256 hash with Difficulty leading 0s

func (*Guard) ValidateChallenge

func (sg *Guard) ValidateChallenge(message []byte, spamguard []byte) bool

ValidateChallenge returns true if the message and spamguard pass the challenge

Jump to

Keyboard shortcuts

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