{"id":45174509,"url":"https://github.com/xkeyideal/captcha","last_synced_at":"2026-02-20T09:08:47.943Z","repository":{"id":57493357,"uuid":"91644818","full_name":"xkeyideal/captcha","owner":"xkeyideal","description":"Go package captcha generation and verification of image, Refer from https://github.com/dchest/captcha. Use captcha pool  generation","archived":false,"fork":false,"pushed_at":"2021-11-29T09:05:47.000Z","size":17,"stargazers_count":30,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-06-20T04:52:17.400Z","etag":null,"topics":["captcha-generator","channel","context","go","goroutine","image-captcha"],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/xkeyideal.png","metadata":{"files":{"readme":"Readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-05-18T03:29:27.000Z","updated_at":"2023-07-16T09:56:39.000Z","dependencies_parsed_at":"2022-08-28T15:13:03.162Z","dependency_job_id":null,"html_url":"https://github.com/xkeyideal/captcha","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/xkeyideal/captcha","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xkeyideal%2Fcaptcha","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xkeyideal%2Fcaptcha/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xkeyideal%2Fcaptcha/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xkeyideal%2Fcaptcha/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xkeyideal","download_url":"https://codeload.github.com/xkeyideal/captcha/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xkeyideal%2Fcaptcha/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29646634,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-20T08:48:14.886Z","status":"ssl_error","status_checked_at":"2026-02-20T08:45:26.777Z","response_time":59,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["captcha-generator","channel","context","go","goroutine","image-captcha"],"created_at":"2026-02-20T09:08:47.231Z","updated_at":"2026-02-20T09:08:47.938Z","avatar_url":"https://github.com/xkeyideal.png","language":"Go","readme":"Package captcha\n=====================\n\nPackage captcha implements generation and verification of image\nCAPTCHAs.\n\nA captcha solution is the sequence of digits 0-9 with the defined length.\n\nAn image representation is a PNG-encoded or JPEG-encoded  image with the solution printed on\nit in such a way that makes it hard for computers to solve it using OCR.\n\nThis package doesn't require external files or libraries to generate captcha\nrepresentations; it is self-contained.\n\nPackage code refer from [dchest/captcha](https://github.com/dchest/captcha)\n\nAdvantages:\n\n1. High-Performance：Generation captcha use goroutine + channel,  get captcha ready in advance by channel\n2. Change panic to error, avoid runtime panic\n3. Not inline store interface, can use any store method such as Redis, Memcache, Memory and so on after get captcha image\n4. Use uuid instead of original random id avoid conflict\n5. Add Context to control generate captcha goroutine, can stop generate programming active\n\n\n`go get github.com/xkeyideal/captcha`\n\nExamples\n--------\n\n![Image](https://github.com/xkeyideal/captcha/raw/master/image/exampleimage.png)\n\nFunctions\n---------\n\n### func NewCaptchaPool\n\n\tNewCaptchaPool(width, height, wordLength, poolsize, parallelNum, imageType int)\n\nCreates a new captcha pool\n\n1. width, height: image's width and height\n2. wordLength: generate words' length\n3. poolsize: buffer size\n4. parallelNum: goroutine number\n5. imageType: PNG or JPEG\n\n### func Stop\n\n\tfunc (p *CaptchaPool) Stop()\n\nStop CaptchaPool active\n\nUsage\n--------\n```go\n    type CaptchaBody struct {\n    \tId   string\n    \tData *bytes.Buffer\n    \tVal  []byte\n    }\n    \n    CaptchaPool = pool.NewCaptchaPool(240, 80, 6, 10, 1, 2)\n    \n    captchaBody := CaptchaPool.GetImage()\n\t\n\tCaptchaPool.Stop()\n    \n```\nSee detail in file [captcha.go](https://github.com/xkeyideal/captcha/blob/master/captcha.go)\n\nGolang context can't control goroutine channel will deadlock by using sync.WaitGroup to wait all goroutine return and close channels.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxkeyideal%2Fcaptcha","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxkeyideal%2Fcaptcha","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxkeyideal%2Fcaptcha/lists"}