NanoCaptcha

A Java-based CAPTCHA implementation with a minimum of dependencies.

License

License

Categories

Categories

Net
GroupId

GroupId

net.logicsquad
ArtifactId

ArtifactId

nanocaptcha
Last Version

Last Version

1.2
Release Date

Release Date

Type

Type

jar
Description

Description

NanoCaptcha
A Java-based CAPTCHA implementation with a minimum of dependencies.
Project URL

Project URL

https://github.com/logicsquad/nanocaptcha
Project Organization

Project Organization

Logic Squad
Source Code Management

Source Code Management

https://github.com/logicsquad/nanocaptcha/tree/master

Download nanocaptcha

How to add to project

<!-- https://jarcasting.com/artifacts/net.logicsquad/nanocaptcha/ -->
<dependency>
    <groupId>net.logicsquad</groupId>
    <artifactId>nanocaptcha</artifactId>
    <version>1.2</version>
</dependency>
// https://jarcasting.com/artifacts/net.logicsquad/nanocaptcha/
implementation 'net.logicsquad:nanocaptcha:1.2'
// https://jarcasting.com/artifacts/net.logicsquad/nanocaptcha/
implementation ("net.logicsquad:nanocaptcha:1.2")
'net.logicsquad:nanocaptcha:jar:1.2'
<dependency org="net.logicsquad" name="nanocaptcha" rev="1.2">
  <artifact name="nanocaptcha" type="jar" />
</dependency>
@Grapes(
@Grab(group='net.logicsquad', module='nanocaptcha', version='1.2')
)
libraryDependencies += "net.logicsquad" % "nanocaptcha" % "1.2"
[net.logicsquad/nanocaptcha "1.2"]

Dependencies

test (1)

Group / Artifact Type Version
junit : junit jar 4.13.1

Project Modules

There are no modules declared in this project.

License

NanoCaptcha

What is this?

NanoCaptcha is a Java library for generating image and audio CAPTCHAs. NanoCaptcha is intended to be:

  • Self-contained: no network API hits to any external services.

  • Minimally-dependent: using NanoCaptcha should not involve pulling in a plethora of JARs, and ideally none at all.

Getting started

You can build a minimal image CAPTCHA very easily:

ImageCaptcha imageCaptcha = new ImageCaptcha.Builder(200, 50).addContent().build();

This creates a 200 x 50 pixel image and adds five random characters from the Latin alphabet. The getImage() method returns the image as a BufferedImage object. isCorrect(String) will verify the supplied string against the text content of the image. If you need the text content itself, call getContent(). Image CAPTCHAs can be further customised by:

  • Using different ContentProducers (e.g., ChineseContentProducer).
  • Adding noise using a NoiseProducer.
  • Adding various ImageFilters.
  • Adding a background or a border.

Building a minimal audio CAPTCHA is just as easy:

AudioCaptcha audioCaptcha = new AudioCaptcha.Builder().addContent().build();

As with image CAPTCHAs, these can be further customised by:

  • Adding background noise with a NoiseProducer.

Using NanoCaptcha

You can use NanoCaptcha in your projects by including it as a Maven dependency:

<dependency>
  <groupId>net.logicsquad</groupId>
  <artifactId>nanocaptcha</artifactId>
  <version>1.2</version>
</dependency>

Roadmap

The following are some potential ideas for future releases:

  1. Further reduce the public API surface where possible. A first pass over the SimpleCaptcha code made a few reductions, but there might be scope for more.

Contributing

By all means, open issue tickets and pull requests if you have something to contribute.

References

NanoCaptcha is based on SimpleCaptcha, and incorporates code from JH Labs Java Image Filters.

net.logicsquad

Logic Squad

We specialise in designing and building bespoke applications for the web and mobile (iOS & Android), for small to medium businesses.

Versions

Version
1.2
1.1
1.0