{"id":24291728,"url":"https://github.com/golang-module/base64captcha","last_synced_at":"2026-02-20T01:01:25.736Z","repository":{"id":271515689,"uuid":"913608158","full_name":"golang-module/base64Captcha","owner":"golang-module","description":"A simple, semantic and developer-friendly captcha package for golang","archived":false,"fork":false,"pushed_at":"2025-01-18T02:47:52.000Z","size":10704,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-11-03T10:06:17.288Z","etag":null,"topics":["base64","base64captcha","captcha"],"latest_commit_sha":null,"homepage":"https://pkg.go.dev/github.com/golang-module/base64Captcha","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/golang-module.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-01-08T02:35:39.000Z","updated_at":"2025-06-18T10:40:07.000Z","dependencies_parsed_at":"2025-07-08T12:10:45.618Z","dependency_job_id":"a7a1604a-066f-45f9-90a6-60fd88277aae","html_url":"https://github.com/golang-module/base64Captcha","commit_stats":null,"previous_names":["golang-module/base64captcha","golang-module/captcha"],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/golang-module/base64Captcha","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/golang-module%2Fbase64Captcha","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/golang-module%2Fbase64Captcha/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/golang-module%2Fbase64Captcha/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/golang-module%2Fbase64Captcha/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/golang-module","download_url":"https://codeload.github.com/golang-module/base64Captcha/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/golang-module%2Fbase64Captcha/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29637915,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-19T22:32:43.237Z","status":"ssl_error","status_checked_at":"2026-02-19T22:32:38.330Z","response_time":117,"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":["base64","base64captcha","captcha"],"created_at":"2025-01-16T14:57:40.164Z","updated_at":"2026-02-20T01:01:25.715Z","avatar_url":"https://github.com/golang-module.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Captcha  #\n\n[![Carbon Release](https://img.shields.io/github/release/golang-module/base64Captcha.svg)](https://github.com/golang-module/base64Captcha/releases)\n[![Go Test](https://github.com/golang-module/base64Captcha/actions/workflows/test.yml/badge.svg)](https://github.com/golang-module/base64Captcha/actions)\n[![Go Report Card](https://goreportcard.com/badge/github.com/golang-module/base64Captcha)](https://goreportcard.com/report/github.com/golang-module/base64Captcha)\n[![Carbon Doc](https://img.shields.io/badge/go.dev-reference-brightgreen?logo=go\u0026logoColor=white\u0026style=flat)](https://pkg.go.dev/github.com/golang-module/base64Captcha)\n[![License](https://img.shields.io/github/license/golang-module/base64Captcha)](https://github.com/golang-module/base64Captcha/blob/master/LICENSE)\n\n#### 项目简介\n\n一个轻量级、语义化、对开发者友好的 `golang` 验证码库，支持任何 Unicode 字符，可以轻松定制以支持语音、数学、中文、韩语、日语等\n\n\u003e Fork 于 [mojotv/base64Captcha](https://github.com/mojotv/base64Captcha)，由于原仓库不再更新和维护，所以拉取了一个分支，在此对原作者表示感谢。\n\n#### 仓库地址\n\n[github.com/golang-module/base64Captcha](https://github.com/golang-module/base64Captcha \"github.com/golang-module/base64Captcha\")\n\n#### 安装使用\n\n##### go version \u003e= 1.16\n\n```go\ngo get -u github.com/golang-module/base64Captcha\n```\n\n#### 用法示例\n\n```go\nimport \"github.com/golang-module/base64Captcha/store\n\n// 使用内存存储(默认)\nbase64Store := store.DefaultMemoryStore\n\n// 使用 sync map 存储\nbase64Store := store.DefaultSyncMapStore\n```\n\n#### 驱动配置\n\n\u003e 自定义配置时可以只定义需要修改的配置项，其他配置项将使用默认配置项\n\n##### 1、配置纯数字验证码\n\n```go\n// 使用默认配置\nbase64Driver := driver.DefaultDriverDigit\n\n// 使用自定义配置\nbase64Driver := driver.NewDriverDigit(driver.DriverDigit{\n    Width:    240, // 宽度\n    Height:   60,  // 高度\n    Length:   6, // 长度\n    NoiseCount: 2, // 点数量\n    Source: \"0123456789\",\n    Fonts: []string{\"wqy-microhei.ttc\"}, // 显示字体\n    BgColor: \u0026color.RGBA{R: 0, G: 0, B: 0, A: 0}, // 背景颜色\n})\n```\n\n![digit](assets/digit.png)\n\n##### 2、配置纯字母验证码\n\n```go\n// 使用默认配置\nbase64Driver := driver.DefaultDriverLetter\n\n// 使用自定义配置\nbase64Driver := driver.NewDriverLetter(driver.DriverLetter{\n    Width:    240, // 宽度\n    Height:   60,  // 高度\n    Length:   6,   // 长度\n    NoiseCount: 2, // 点数量\n    Source: \"ABCDEFGHJKMNOQRSTUVXYZabcdefghjkmnoqrstuvxyz\",\n    Fonts: []string{\"wqy-microhei.ttc\"}, // 显示字体\n    BgColor: \u0026color.RGBA{R: 0, G: 0, B: 0, A: 0}, // 背景颜色\n})\n```\n\n![letter](assets/letter.png)\n\n##### 2、配置数学运算验证码\n\n```go\n// 使用默认配置\nbase64Driver := driver.DefaultDriverMath\n\n// 使用自定义配置\nbase64Driver := driver.NewDriverMath(driver.DriverMath{\n    Width:           240, // 宽度\n    Height:          60,  // 高度\n    NoiseCount:      2, // 点数量\n    ShowLineOptions: 0, // 显示线条 \n    Fonts:           []string{\"wqy-microhei.ttc\"}, // 显示字体\n    BgColor:         \u0026color.RGBA{R: 0, G: 0, B: 0, A: 0}, // 背景颜色\n})\n```\n\n![math](assets/math.png)\n\n##### 3、配置字符串验证码(包含数字、大小写字母)\n\n```go\n// 使用默认配置\nbase64Driver := driver.DefaultDriverString\n\n// 使用自定义配置\nbase64Driver := driver.NewDriverString(driver.DriverString{\n    Width:           240, // 宽度\n    Height:          60,  // 高度\n    Length:          6, // 长度\n    NoiseCount:      2, // 点数量\n    ShowLineOptions: 0,                                              // 显示线条\n    Source:          \"ABCDEFGHJKMNOQRSTUVXYZabcdefghjkmnoqrstuvxyz\", // 字符源\n    Fonts:           []string{\"wqy-microhei.ttc\"}, // 显示字体\n    BgColor:         \u0026color.RGBA{R: 0, G: 0, B: 0, A: 0}, // 背景颜色\n})\n```\n\n![string](assets/string.png)\n\n##### 4、配置汉字验证码\n\n```go\n// 使用默认配置\nbase64Driver := driver.DefaultDriverChinese\n\n// 使用自定义配置\nbase64Driver := driver.NewDriverChinese(driver.DriverChinese{\n    Width:           240, // 宽度\n    Height:          60,  // 高度\n    Length:          6, // 长度\n    NoiseCount:      2, // 点数量\n    ShowLineOptions: 0,                                                                                                                                      // 显示线条\n    Source:          \"设想,你在,处理,消费者,的音,频输,出音,频可,能无,论什,么都,没有,任何,输出,或者,它可,能是,单声道,立体声,或是,环绕立,体声的,,不想要,的值\", // 字符源\n    Fonts:           []string{\"wqy-microhei.ttc\"}, // 显示字体\n    BgColor:         \u0026color.RGBA{R: 125, G: 125, B: 0, A: 118}, // 背景颜色\n})\n```\n\n![chinese](assets/chinese.png)\n\n##### 5、配置语音验证码\n\n```go\n// 使用默认配置\nbase64Driver := driver.DefaultDriverAudio\n\n// 使用自定义配置\nbase64Driver := driver.NewDriverAudio(driver.DriverAudio{\n    Length:   6, // 长度\n    Language: \"en\", // 语言，目前支持：en、zh、ja、ru、de\n})\n```\n\n![audio](assets/audio.png)\n\n##### 生成验证码\n\n```go\ncaptcha := base64Captcha.NewCaptcha(base64Driver, base64Store)\n\n// 生成验证码\nid, src, answer, err = captcha.Generate()\n\n// 验证验证码\ncaptcha.Verify(id, answer, true)\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgolang-module%2Fbase64captcha","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgolang-module%2Fbase64captcha","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgolang-module%2Fbase64captcha/lists"}