All Projects → xkeyideal → captcha

xkeyideal / captcha

Licence: MIT license
Go package captcha generation and verification of image, Refer from https://github.com/dchest/captcha. Use captcha pool generation

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to captcha

retrygroup
Package retrygroup provides synchronization, Context cancelation for groups of retry goroutines working on subtasks of a common task.
Stars: ✭ 18 (-37.93%)
Mutual labels:  context, goroutine
context
A proof of concept implementation of scoped context
Stars: ✭ 16 (-44.83%)
Mutual labels:  context, goroutine
chanbroker
ChanBroker, a Broker for goroutine, is simliar to kafka
Stars: ✭ 61 (+110.34%)
Mutual labels:  channel, goroutine
Hunch
Hunch provides functions like: All, First, Retry, Waterfall etc., that makes asynchronous flow control more intuitive.
Stars: ✭ 94 (+224.14%)
Mutual labels:  channel, context
ACVR2017
An Innovative Salient Object Detection Using Center-Dark Channel Prior
Stars: ✭ 20 (-31.03%)
Mutual labels:  channel
comfy-channel
A 24/7 live video broadcast with automatic content selection and overlays using FFMPEG and Python!
Stars: ✭ 37 (+27.59%)
Mutual labels:  channel
ops channel
命令通道是联接人与机器,人与业务的一座桥.它跟常用的开源运维工具(`ansible`,`saltstack`,`puppet`)有相似之处,但也有着本质的差异。
Stars: ✭ 34 (+17.24%)
Mutual labels:  channel
Channel-Message-Editor
A telegram channel message editor bot.
Stars: ✭ 21 (-27.59%)
Mutual labels:  channel
WormHole
WormHole allows to share classes between Flutter and Native Platform (android / ios)
Stars: ✭ 36 (+24.14%)
Mutual labels:  channel
ray-tracing
This is a go implementation of the "Ray Tracing in One Weekend" book
Stars: ✭ 37 (+27.59%)
Mutual labels:  goroutine
channelHelper
基于walle工具的多渠道打包脚本
Stars: ✭ 35 (+20.69%)
Mutual labels:  channel
channels
go channel patterns
Stars: ✭ 86 (+196.55%)
Mutual labels:  channel
prosumer
A producer-consumer solution for Golang
Stars: ✭ 31 (+6.9%)
Mutual labels:  channel
Investigo
🔎 Find usernames and download their data across social media.
Stars: ✭ 168 (+479.31%)
Mutual labels:  goroutine
channel
Go-like channels for JavaScript
Stars: ✭ 49 (+68.97%)
Mutual labels:  channel
ring-channel
Bounded MPMC channel abstraction on top of a ring buffer
Stars: ✭ 24 (-17.24%)
Mutual labels:  channel
cs-wordpress-bouncer
CrowdSec is an open-source cyber security tool. This plugin blocks detected attackers or display them a captcha to check they are not bots.
Stars: ✭ 25 (-13.79%)
Mutual labels:  captcha-generator
pyphysim
Simulation of Digital Communication (physical layer) in Python.
Stars: ✭ 78 (+168.97%)
Mutual labels:  channel
Protobuf-Dreamer
A tiled DeepDream project for creating any size of image, on both CPU and GPU
Stars: ✭ 39 (+34.48%)
Mutual labels:  channel
workerpool
A workerpool that can get expanded & shrink dynamically.
Stars: ✭ 55 (+89.66%)
Mutual labels:  goroutine

Package captcha

Package captcha implements generation and verification of image CAPTCHAs.

A captcha solution is the sequence of digits 0-9 with the defined length.

An image representation is a PNG-encoded or JPEG-encoded image with the solution printed on it in such a way that makes it hard for computers to solve it using OCR.

This package doesn't require external files or libraries to generate captcha representations; it is self-contained.

Package code refer from dchest/captcha

Advantages:

  1. High-Performance:Generation captcha use goroutine + channel, get captcha ready in advance by channel
  2. Change panic to error, avoid runtime panic
  3. Not inline store interface, can use any store method such as Redis, Memcache, Memory and so on after get captcha image
  4. Use uuid instead of original random id avoid conflict
  5. Add Context to control generate captcha goroutine, can stop generate programming active

go get github.com/xkeyideal/captcha

Examples

Image

Functions

func NewCaptchaPool

NewCaptchaPool(width, height, wordLength, poolsize, parallelNum, imageType int)

Creates a new captcha pool

  1. width, height: image's width and height
  2. wordLength: generate words' length
  3. poolsize: buffer size
  4. parallelNum: goroutine number
  5. imageType: PNG or JPEG

func Stop

func (p *CaptchaPool) Stop()

Stop CaptchaPool active

Usage

    type CaptchaBody struct {
    	Id   string
    	Data *bytes.Buffer
    	Val  []byte
    }
    
    CaptchaPool = pool.NewCaptchaPool(240, 80, 6, 10, 1, 2)
    
    captchaBody := CaptchaPool.GetImage()
	
	CaptchaPool.Stop()
    

See detail in file captcha.go

Golang context can't control goroutine channel will deadlock by using sync.WaitGroup to wait all goroutine return and close channels.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].