29 lines
873 B
C#
29 lines
873 B
C#
using System;
|
|
using System.Drawing;
|
|
using System.Drawing.Imaging;
|
|
using System.IO;
|
|
using System.Text;
|
|
|
|
namespace HushianWebApp.Service
|
|
{
|
|
public static class CaptchaService
|
|
{
|
|
public static string GetCaptchaWord(int length)
|
|
{
|
|
var random = new Random(DateTime.Now.Millisecond);
|
|
|
|
// const string chars = "ABCDEFGHJKLMNPQRSTUWYZabcdefghijkmnpqrstuwz23456789*#!$%=";
|
|
const string chars = "ABCDEFGHJKLMNPQRSTUWYZabcdefghijkmnpqrstuwz23456789";
|
|
string cw = new(Enumerable.Repeat(chars, length)
|
|
.Select(s => s[random.Next(s.Length)])
|
|
.ToArray());
|
|
|
|
return cw;
|
|
}
|
|
public static string GenerateCaptchaBase64(string text, int width = 120, int height = 40)
|
|
{
|
|
return "";
|
|
}
|
|
}
|
|
}
|