Catchup 2.0.2
dotnet add package Catchup --version 2.0.2
NuGet\Install-Package Catchup -Version 2.0.2
<PackageReference Include="Catchup" Version="2.0.2" />
<PackageVersion Include="Catchup" Version="2.0.2" />
<PackageReference Include="Catchup" />
paket add Catchup --version 2.0.2
#r "nuget: Catchup, 2.0.2"
#:package Catchup@2.0.2
#addin nuget:?package=Catchup&version=2.0.2
#tool nuget:?package=Catchup&version=2.0.2
Catchup
Catchup is a simple nuget package made with C#.
Description
Catchup produces a random 6 characters Alphanumeric string to be read by human beings. Users must enter the exact match of the text generated to become validated as a non-robotic user.
Setup
I recommend to make an instance of "Catchupper" class so you can access the methods and use them inside your business layer, or you can easily register the class "Catchupper" with its interface "ICatchup" as a dependency in Dependency Container and inject it in your own class.
How it works
Get a captcha in image as byte array
To get a generated random captcha image, use GetAnImageCaptcha() method. This method returns an object which contains a captcha string and a byte array that you can use directly in image tag.
You can also customize the output by passing an optional
CaptchaOptions
object to the method:
var customOptions = new CaptchaOptions
{
Width = 250,
Height = 100,
FontSize = 50,
CaptchaLength = 5,
LineNoiseCount = 20,
DotNoiseCount = 300
};
var captcha = catchup.GetAnImageCaptcha(customOptions);
Examples in UI
- Example in html pages:
<img style="width:500px;" src='data:image/png;base64, ' + imageInByteArray" />
- Example in razor pages:
<img style="width:500px;" src="@String.Format("data:image/png;base64,{0}", Convert.ToBase64String(imageInByteArray))" />"
Solve the captcha
- To validate user as a non-robotic one, use CheckCaptcha(string riddle, string solution). This method accepts two required arguments as the riddle and solution of it. the first one is the string you got from GetAnImageCaptcha() method and the second one (solution) is the number user sends as the answer. the method returns a boolean which determines if the answer is correct or not.
Important
It is obvious that to prevent from attacks, you better store the generated captcha with a unique Id who is requesting for it, so the attacker can't send you the similar riddle and his solution. This package is not doing it as it maybe differences in different project flows.
From author
Of course that this package is not perfect and can be extended in many ways. Please FEEL FREE TO CONTRIBUTE, DEVELOP AND FIX BUGS by a pull request. I'd be glad to hear your suggestions or anything else from you through alireza_mortezaei@hotmail.com
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net6.0
- SixLabors.ImageSharp (>= 2.1.1)
- SkiaSharp (>= 2.88.0)
- SkiaSharp.HarfBuzz (>= 2.88.0)
- System.Drawing.Common (>= 6.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Please feel free to contribute