增加内置字体、贝塞尔曲线、算术验证码、base64输出

This commit is contained in:
whvcse@foxmail.com
2019-08-24 00:23:35 +08:00
parent 8ebe5918c9
commit 4d3629aa2e
3 changed files with 13 additions and 5 deletions

View File

@@ -1,17 +1,17 @@
package com.wf.captcha.base;
import java.util.Random;
import java.security.SecureRandom;
/**
* 随机数工具类
* Created by 王帆 on 2018-07-27 上午 10:08.
*/
public class Randoms {
protected static final Random RANDOM = new Random();
// 定义验证码字符.去除了O和I等容易混淆的字母
protected static final SecureRandom RANDOM = new SecureRandom();
// 定义验证码字符.去除了0、O、I、L等容易混淆的字母
public static final char ALPHA[] = {'2', '3', '4', '5', '6', '7', '8', '9',
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'G', 'K', 'M', 'N', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'm', 'n', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'};
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J', 'K', 'M', 'N', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'j', 'k', 'm', 'n', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'};
protected static final int numMaxIndex = 8; // 数字的最大索引,不包括最大值
protected static final int charMinIndex = numMaxIndex; // 字符的最小索引,包括最小值
protected static final int charMaxIndex = ALPHA.length; // 字符的最大索引,不包括最大值