captcha

package
v0.0.0-...-2083224 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// StdLen Standard length of uniuri string to achive ~95 bits of entropy.
	StdLen = 16
	// UUIDLen Length of uniurl string to achive ~119 bits of entropy, closest
	// to what can be losslessly converted to UUIDv4 (122 bits).
	UUIDLen = 20
)

Variables

View Source
var StdChars = []byte("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789")

StdChars Standard characters allowed in uniuri string.

Functions

func New

func New() string

New returns a new random string of the standard length, consisting of standard characters.

func NewLen

func NewLen(length int) string

NewLen returns a new random string of the provided length, consisting of standard characters.

func NewLenChars

func NewLenChars(length int, chars []byte) string

NewLenChars returns a new random string of the provided length, consisting of the provided byte slice of allowed characters (maximum 256).

Types

type Image

type Image struct {
	*image.NRGBA
	// contains filtered or unexported fields
}

Image image struct

func Fetch

func Fetch() (*Image, string)

Fetch gen a captcha image

func NewImage

func NewImage(digits []byte, width, height int) *Image

NewImage create a new image

func (*Image) WriteTo

func (img *Image) WriteTo(w io.Writer) (int64, error)

WriteTo write into image

Jump to

Keyboard shortcuts

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