You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
lib/captcha/captcha.go

15 lines
351 B
Go

4 years ago
package captcha
import (
"github.com/mojocn/base64Captcha"
)
func Generate() (string, string, error) {
driver := base64Captcha.NewDriverDigit(80, 160, 4, 0.1, 4)
return base64Captcha.NewCaptcha(driver, base64Captcha.DefaultMemStore).Generate()
}
func Verify(id, code string) bool {
return base64Captcha.DefaultMemStore.Verify(id, code, true)
}