all repos — captcha @ v1.0.0

Go package captcha implements generation and verification of image and audio CAPTCHAs.

aa277053
Add go.mod
Dmitry Chestnykh dmitry@codingrobots.com
Sat, 16 Jul 2022 17:26:09 +0200
1e758d41
Merge pull request #45 from vapehacker/master

Update Chinese sounds and background sound level
Dmitry Chestnykh dmitry@codingrobots.com
Sat, 16 Jul 2022 17:23:44 +0200
03f5f033
Add warning to README
Dmitry Chestnykh dmitry@codingrobots.com
Thu, 03 Sep 2020 13:35:50 +0200
6a29415a
Add Japanese sounds (language: "ja")

Contributed by email.
Dmitry Chestnykh dmitry@codingrobots.com
Thu, 22 Jun 2017 17:38:21 +0200
7404d0ed
Fix typo in comment
Dmitry Chestnykh dmitry@codingrobots.com
Sun, 04 Jun 2017 13:07:05 +0200
9e952142
Merge pull request #8 from rainyear/master

Update README.md
Dmitry Chestnykh dmitry@codingrobots.com
Tue, 28 Jul 2015 14:50:59 +0200
84aa9399
Use ServeContent in Server.

This makes Server support Range request, fixing issue with Safari not
playing audio.
Dmitry Chestnykh dmitry@codingrobots.com
Sat, 25 Apr 2015 11:28:47 +0200
6a5989d7
Gofmt.
Dmitry Chestnykh dmitry@codingrobots.com
Sat, 25 Apr 2015 11:28:41 +0200
1c861dea
Fix modulo bias in randomBytesMod.

See
https://github.com/dchest/uniuri/commit/2e215562f605dacd124f15eb89523bdc32da3a41
Dmitry Chestnykh dmitry@codingrobots.com
Fri, 24 Apr 2015 15:21:27 +0200
e965f48e
capexample: listen on localhost.
Dmitry Chestnykh dmitry@codingrobots.com
Tue, 21 Apr 2015 15:31:18 +0200
3eb958d7
In Server set headers to disable any caching.
Dmitry Chestnykh dmitry@codingrobots.com
Mon, 20 Apr 2015 16:25:46 +0200
50fb09e8
Make sure dotSize is never less than 1.

This fixes panic due in PRNG "invalid argument to Intn" due to
requesting random number with no range (0).
Dmitry Chestnykh dmitry@codingrobots.com
Mon, 20 Apr 2015 16:00:42 +0200
997004be
Fix condition; remove unreachable panic.
Dmitry Chestnykh dmitry@codingrobots.com
Sat, 09 Aug 2014 16:05:42 +0200
31461913
Gofmt; make capgensound produce gofmt'ed output.
Dmitry Chestnykh dmitry@codingrobots.com
Mon, 12 May 2014 14:40:09 +0200
90158fbe
Generate captcha representations deterministically.

WARNING: introduces API incompatibility!

This package generates captcha representations on-the-fly; for instance,
if captcha solution was "123456", every call to NewImage() using this
sequence of digits would generate a different random image containing
"123456"; similarly, NewAudio() would generate a different audio
pronouncing the same sequence: 1, 2, 3, 4, 5, 6.

If a user, instead of storing generated outputs, exposes this
functionality from their server, which is the default and recommended
behaviour, an attacker could try loading the same image or audio over
and over again in attempt to arrive at the most correct optical/voice
recognition result.

Instead of using a global non-deterministic pseudorandom number
generator to distort images and audio, this commit introduces a
deterministic PRNG for each image/audio. This PRNG uses a combination of
a global secret key (generated once during initialization from a system
CSPRNG) and captcha id and solution to produce pseudorandom numbers for
each representation deterministically. Thus, calling NewImage() with the
same captcha id and solution at different times will result in the same
image (ditto for NewAudio).

To make results unique not only for different solutions, but also for
ids, these incompatible changes to public API have been introduced:

NewImage and NewAudio changed from:

  func NewImage(digits []byte, width, height int) *Image
  func NewAudio(digits []byte, lang string) *Audio

to:

  func NewImage(id string, digits []byte, width, height int) *Image
  func NewAudio(id string, digits []byte, lang string) *Audio

That is, they now accept an additional captcha `id` argument.
No other interfaces changed.

Described changes also improved performance of generating captchas.
Dmitry Chestnykh dmitry@codingrobots.com
Sun, 11 May 2014 13:31:22 +0200
26f05681
Use SipHash-based PRNG for image/audio variations.
Dmitry Chestnykh dmitry@codingrobots.com
Fri, 10 Jan 2014 17:19:06 +0100
73e6160e
Merge pull request #2 from ebfe/typo

Fix typo.
Dmitry Chestnykh dmitry@codingrobots.com
Wed, 11 Dec 2013 13:22:50 -0800
46413fff
Fix typo in comment.
Dmitry Chestnykh dmitry@codingrobots.com
Wed, 04 Dec 2013 11:42:31 +0100
cede2563
Fix image.WriteTo, properly implementing interface.

Instead of writing directly via png.Encode, encode image
into a buffer first, then write the whole buffer.

~~~
This commit is brought to you by:

http://blog.oleganza.com
Must-have source of knowledge about Bitcoin.
~~~

(Sponsor my commits! https://github.com/dchest/commit-ads)
Dmitry Chestnykh dmitry@codingrobots.com
Tue, 03 Dec 2013 12:17:47 +0100
9ee08184
store: simplify locking.
Dmitry Chestnykh dmitry@codingrobots.com
Sat, 13 Oct 2012 12:24:14 +0200
cab7b0dd
Update .gitignore.
Dmitry Chestnykh dmitry@codingrobots.com
Sun, 11 Mar 2012 20:14:47 +0100
b80c582b
Update docs.
Dmitry Chestnykh dmitry@codingrobots.com
Sun, 11 Mar 2012 20:09:53 +0100
da58f6dc
Add Chinese to generated sounds and example server.
Dmitry Chestnykh dmitry@codingrobots.com
Sun, 11 Mar 2012 20:01:59 +0100
b7c8157b
Add contributed Chinese sounds.
Dmitry Chestnykh dmitry@codingrobots.com
Sun, 11 Mar 2012 19:57:35 +0100
7ac25223
Update README for capgensounds.
Dmitry Chestnykh dmitry@codingrobots.com
Thu, 09 Feb 2012 19:43:43 +0100
47a4cf29
Rename generate to capgensounds.
Dmitry Chestnykh dmitry@codingrobots.com
Thu, 09 Feb 2012 19:42:10 +0100
b1a07266
Remove Makefiles. Rename example.

Go weekly 2012-02-07.

Example is now capexample.
To build helper tools:

   cd capexample && go install
   cd capgen && go install

This will install tools capexample and cangen into $GOPATH/bin.
Dmitry Chestnykh dmitry@codingrobots.com
Thu, 09 Feb 2012 19:37:44 +0100
2eeb2a40
Fix documentation.
Dmitry Chestnykh dmitry@codingrobots.com
Mon, 16 Jan 2012 15:15:02 +0100
acce4f8f
Fix expiration constant.
Dmitry Chestnykh dmitry@codingrobots.com
Mon, 16 Jan 2012 15:14:49 +0100
90a7bd4b
Fix for Go weekly.2012-01-15.
Dmitry Chestnykh dmitry@codingrobots.com
Mon, 16 Jan 2012 15:11:18 +0100
31ad5762
Fix build for Go weekly.2011-10-06.
Dmitry Chestnykh dmitry@codingrobots.com
Mon, 17 Oct 2011 20:47:15 +0200
00c7ab4f
example: Use new template package; write text/html header.
Dmitry Chestnykh dmitry@codingrobots.com
Sun, 21 Aug 2011 16:06:09 +0200
dfb2d7da
generate: README fixes.
Dmitry Chestnykh dmitry@codingrobots.com
Wed, 29 Jun 2011 16:13:29 +0200
e5198f7c
capgen: fix build, add "lang" flag.
Dmitry Chestnykh dmitry@codingrobots.com
Wed, 29 Jun 2011 15:51:37 +0200
dc1ad84b
generate: add info about forking to README.
Dmitry Chestnykh dmitry@codingrobots.com
Wed, 29 Jun 2011 15:03:01 +0200
eab15838
generate: README fixes.
Dmitry Chestnykh dmitry@codingrobots.com
Wed, 29 Jun 2011 14:48:08 +0200
ef8b4cf2
generate: add README about how to create sounds for new languages.
Dmitry Chestnykh dmitry@codingrobots.com
Wed, 29 Jun 2011 14:45:48 +0200
7633411f
Remove notice about Chrome bug, as v12 has been released.
Dmitry Chestnykh dmitry@codingrobots.com
Wed, 29 Jun 2011 14:05:32 +0200
2d50e9fe
random: avoid modulo bias.
Dmitry Chestnykh dmitry@codingrobots.com
Mon, 06 Jun 2011 14:55:43 +0200
d7cb604d
Add copyright headers.

sounds.go doesn't have a copyright header, because the file is generated
by a program. I don't want to make it output the copyright header,
because users can generate sounds themselves, and the copyright status
of such generated files can be different.
Dmitry Chestnykh dmitry@codingrobots.com
Tue, 24 May 2011 11:05:31 +0200
7fee67a2
Better Russian sounds.
Dmitry Chestnykh dmitry@codingrobots.com
Thu, 12 May 2011 14:41:00 +0200
cacbe12b
generate: use filepath instead of path.
Dmitry Chestnykh dmitry@codingrobots.com
Thu, 12 May 2011 12:59:58 +0200
9d0ab4e0
generate: add new line after digitSounds.
Dmitry Chestnykh dmitry@codingrobots.com
Thu, 12 May 2011 12:43:22 +0200
663c7c10
Update README.
Dmitry Chestnykh dmitry@codingrobots.com
Wed, 11 May 2011 23:40:00 +0200
0a3f3296
Mention Russian in package doc.
Dmitry Chestnykh dmitry@codingrobots.com
Wed, 11 May 2011 23:29:46 +0200
1f906795
example: add language dropdown.
Dmitry Chestnykh dmitry@codingrobots.com
Wed, 11 May 2011 23:27:57 +0200
cb56dd20
Add Russian sounds (ru).
Dmitry Chestnykh dmitry@codingrobots.com
Wed, 11 May 2011 23:10:29 +0200
7c629aef
Support other languages in audio captchas.

Server accepts parameter lang, e.g. xxx.wav?lang=en.
NewAudio and WriteAudio accept the target language.
Dmitry Chestnykh dmitry@codingrobots.com
Wed, 11 May 2011 22:16:35 +0200
34dcf8d1
Better error descriptions.
Dmitry Chestnykh dmitry@codingrobots.com
Sun, 08 May 2011 12:14:43 +0200
f0b06e6d
image: s/img/m/
Dmitry Chestnykh dmitry@codingrobots.com
Sun, 08 May 2011 12:12:11 +0200
4559a6b5
Update example.wav.
Dmitry Chestnykh dmitry@codingrobots.com
Wed, 04 May 2011 17:30:58 +0200
0b62e127
audio: increase level of background sounds.
Dmitry Chestnykh dmitry@codingrobots.com
Wed, 04 May 2011 17:21:31 +0200
ebb75a0b
Update generate with new waveHeader.
Dmitry Chestnykh dmitry@codingrobots.com
Sun, 01 May 2011 13:37:58 +0200
05ff9ea7
audio: proper RIFF header generation.

At last!

[RIFF][following size][WAVE]fmt[...]...data[data size][padded data].

Also, update example.wav.
Dmitry Chestnykh dmitry@codingrobots.com
Sun, 01 May 2011 13:31:16 +0200
e6fb7340
audio: error handling; pad byte is 0, not 128.
Dmitry Chestnykh dmitry@codingrobots.com
Sun, 01 May 2011 12:48:01 +0200
ad3bc714
audio: write pad byte when data length is odd.

This is specified in RIFF format, but I forgot to implement.

     ckData  Binary data of fixed or variable size. The start of
	     ckData is word-aligned with respect to the start of the
	     RIFF file.  If the chunk size is an odd number of bytes, a
	     pad byte with value zero is written after ckData.  Word
	     aligning improves access speed (for chunks resident in
	     memory) and maintains compatibility with EA IFF.  The
	     ckSize value does not include the pad byte.

(From http://www.kk.iij4u.or.jp/~kondo/wave/mpidata.txt)
Dmitry Chestnykh dmitry@codingrobots.com
Sun, 01 May 2011 12:33:27 +0200
796c18f3
image: rename a few variables.
Dmitry Chestnykh dmitry@codingrobots.com
Fri, 29 Apr 2011 15:26:14 +0200
f14d4a99
random: seed with Nanoseconds.
Dmitry Chestnykh dmitry@codingrobots.com
Fri, 29 Apr 2011 04:51:24 +0200
c087adeb
Remove dependency on uniuri. Add random.go.

Captcha ids are now 20 characters long.
Dmitry Chestnykh dmitry@codingrobots.com
Thu, 28 Apr 2011 23:12:29 +0200
62d3514c
Add store set/collect benchmark.
Dmitry Chestnykh dmitry@codingrobots.com
Thu, 28 Apr 2011 21:02:19 +0200
d6bfb3fd
image: forgot to use circleCount const in NewImage.
Dmitry Chestnykh dmitry@codingrobots.com
Thu, 28 Apr 2011 20:29:34 +0200
0c420156
image: use paletted image.

This simplifies code and makes it faster. It also produces smaller PNGs.

Before:

captcha.BenchmarkNewImage	500	 6198230 ns/op
captcha.BenchmarkImageWriteTo	100	17517110 ns/op   0.14 MB/s

After:

captcha.BenchmarkNewImage	500	 3869968 ns/op
captcha.BenchmarkImageWriteTo	200	 7237604 ns/op   0.23 MB/s

(Core 2 Duo @ 2.26 GHz, MacBook)

Currently the background is white, not transparent, because PNG encoder
doesn't support paletted images with alpha channel.

Submitted CL: http://codereview.appspot.com/4432078

Change alpha to 0x00 once it's accepted to make captcha transparent.
Dmitry Chestnykh dmitry@codingrobots.com
Thu, 28 Apr 2011 20:09:50 +0200
fe75d4b6
capgen: update for StdLength -> DefaultLen rename.
Dmitry Chestnykh dmitry@codingrobots.com
Thu, 28 Apr 2011 15:58:04 +0200
aef40a9c
Report MB/s in audio and image benchmarks.

Also, audio benchmark uses the new ioutil.Discard.
Dmitry Chestnykh dmitry@codingrobots.com
Thu, 28 Apr 2011 14:58:53 +0200
436e363f
audio: do not change final background level.

Instead, change level of individual reversed sounds when making
background to the appropriate values.

This speeds up makeBackgroundSound ~3%.

Before and after.
captcha.BenchmarkNewAudio      50  30436940 ns/op
captcha.BenchmarkNewAudio      50  29435780 ns/op

Also, level up white noise a bit.
Dmitry Chestnykh dmitry@codingrobots.com
Thu, 28 Apr 2011 11:06:56 +0200
b9845ccf
audio: preallocate reverse sounds (~5% speed up).

Also:
- use ranges everywhere
- optimize makeWhiteNoise a bit

Before and after:
captcha.BenchmarkNewAudio      50  32128580 ns/op
captcha.BenchmarkNewAudio      50  30436940 ns/op
Dmitry Chestnykh dmitry@codingrobots.com
Thu, 28 Apr 2011 01:20:11 +0200
6ca6c386
Add image and audio benchmarks.
Dmitry Chestnykh dmitry@codingrobots.com
Thu, 28 Apr 2011 01:19:56 +0200
d4eb7a3c
Update README again.
Dmitry Chestnykh dmitry@codingrobots.com
Thu, 28 Apr 2011 00:13:39 +0200
b4213101
Update README.
Dmitry Chestnykh dmitry@codingrobots.com
Thu, 28 Apr 2011 00:12:19 +0200
a85bba10
Fix tests.
Dmitry Chestnykh dmitry@codingrobots.com
Thu, 28 Apr 2011 00:02:57 +0200
5192a066
image: remove random variations in drawDigit's x,y.

For the standard size and width with new font they no longer had any
effect anyway (were always +0).
Dmitry Chestnykh dmitry@codingrobots.com
Wed, 27 Apr 2011 23:37:21 +0200
de409bf9
image: precalculate dx in distort and strikeThrough.
Dmitry Chestnykh dmitry@codingrobots.com
Wed, 27 Apr 2011 23:28:27 +0200
a7f7c639
server: better names for arguments to Server.
Dmitry Chestnykh dmitry@codingrobots.com
Wed, 27 Apr 2011 23:17:28 +0200
647026ab
New now returns captcha with default length.

NewLen is now like the old New (accepts captcha length as the argument).
Also, rename StdLength to DefaultLen.
Dmitry Chestnykh dmitry@codingrobots.com
Wed, 27 Apr 2011 23:11:38 +0200
c5afad97
captcha: remove Collect method.

Garbage collection is an internal detail of a Store, and requiring to
export this method seem to be not very useful.

The default memory store, of course, still has garbage collection, but
it's not the unexported method, called in Set as usual.
Dmitry Chestnykh dmitry@codingrobots.com
Wed, 27 Apr 2011 23:00:06 +0200
e136731c
image: fix terminology again.
Dmitry Chestnykh dmitry@codingrobots.com
Wed, 27 Apr 2011 21:20:21 +0200
719496cd
image: refactor, fix terminology.
Dmitry Chestnykh dmitry@codingrobots.com
Wed, 27 Apr 2011 21:14:22 +0200
41391fd0
Update README again.
Dmitry Chestnykh dmitry@codingrobots.com
Wed, 27 Apr 2011 20:54:49 +0200
d2a6c654
Update README.
Dmitry Chestnykh dmitry@codingrobots.com
Wed, 27 Apr 2011 20:53:41 +0200
79c3ed21
Update example.png.
Dmitry Chestnykh dmitry@codingrobots.com
Wed, 27 Apr 2011 20:51:13 +0200
1b34f643
image: new wave distortion, and strike-through.
Dmitry Chestnykh dmitry@codingrobots.com
Wed, 27 Apr 2011 20:44:24 +0200
d6b0f36e
example: print the address of server.
Dmitry Chestnykh dmitry@codingrobots.com
Wed, 27 Apr 2011 20:43:43 +0200
c6bfbfa6
font: more readable 1 and 7.
Dmitry Chestnykh dmitry@codingrobots.com
Wed, 27 Apr 2011 19:16:35 +0200
307ecdad
image: use font with better resolution.
Dmitry Chestnykh dmitry@codingrobots.com
Wed, 27 Apr 2011 18:41:58 +0200
b8bb54f6
image: simplify skew randomization.

Use rndf instead of rand.Float64 voodoo.
Dmitry Chestnykh dmitry@codingrobots.com
Wed, 27 Apr 2011 15:55:36 +0200
a6788822
example: add "Try another one" link; ignore /xxx.

Only return page for root path /, return 404 for any other, such as
/favicon.ico.
Dmitry Chestnykh dmitry@codingrobots.com
Wed, 27 Apr 2011 15:54:27 +0200
1f117474
server: fix "multiple response.WriteHeader calls".

The server no does nothing for errors other than ErrNotFound (for which
it calls http.NotFound). This is becase when getting error on writing,
we already wrote headers, so can't respond with status 500.

Possibly log errors in future?
Dmitry Chestnykh dmitry@codingrobots.com
Wed, 27 Apr 2011 15:52:32 +0200
3218681e
example: update with recent download changes.
Dmitry Chestnykh dmitry@codingrobots.com
Wed, 27 Apr 2011 13:12:28 +0200
c72fa4f2
server: serve downloads from "/download/".

Also, refactor methods.
Dmitry Chestnykh dmitry@codingrobots.com
Wed, 27 Apr 2011 13:09:22 +0200
6e79acad
Move server parts to server.go.
Dmitry Chestnykh dmitry@codingrobots.com
Wed, 27 Apr 2011 12:30:13 +0200
316aacb9
Server: disable uppercase extensions (.PNG, .WAV).

Also fixes comment typo.
Dmitry Chestnykh dmitry@codingrobots.com
Wed, 27 Apr 2011 00:41:52 +0200
0052db45
example: use io instead of fmt; add error handling.
Dmitry Chestnykh dmitry@codingrobots.com
Tue, 26 Apr 2011 21:32:16 +0200
885d67a6
store: fix potential race.
Dmitry Chestnykh dmitry@codingrobots.com
Tue, 26 Apr 2011 19:16:09 +0200
60d32e9f
store: rename ids to digitsById, exp to idByTime.
Dmitry Chestnykh dmitry@codingrobots.com
Tue, 26 Apr 2011 18:57:16 +0200
a0a9c943
Update docs.
Dmitry Chestnykh dmitry@codingrobots.com
Tue, 26 Apr 2011 18:36:54 +0200
c833d164
Add examples captchas.
Dmitry Chestnykh dmitry@codingrobots.com
Tue, 26 Apr 2011 18:34:52 +0200
5c81f018
Use new GitHub-flavored Markdown syntax for types.
Dmitry Chestnykh dmitry@codingrobots.com
Tue, 26 Apr 2011 15:22:52 +0200
31e7bb63
Rename README to README.md
Dmitry Chestnykh dmitry@codingrobots.com
Tue, 26 Apr 2011 14:59:32 +0200
ca43a14c
Add README.
Dmitry Chestnykh dmitry@codingrobots.com
Tue, 26 Apr 2011 14:58:42 +0200
d671ee04
Example: make HTML5 valid.
Dmitry Chestnykh dmitry@codingrobots.com
Tue, 26 Apr 2011 13:18:06 +0200
b6b09caf
Example: implement reloading; fix audio in Safari.
Dmitry Chestnykh dmitry@codingrobots.com
Tue, 26 Apr 2011 13:14:01 +0200
0476dc3b
Server: reload captcha when given ?reload=x in URL.
Dmitry Chestnykh dmitry@codingrobots.com
Tue, 26 Apr 2011 13:04:11 +0200
8d3ca40d
Add notice about Chrome 10 bug to BUGS.
Dmitry Chestnykh dmitry@codingrobots.com
Mon, 25 Apr 2011 23:53:22 +0200
a9e88462
Add notice about Image.WriteTo to BUGS.
Dmitry Chestnykh dmitry@codingrobots.com
Mon, 25 Apr 2011 23:43:27 +0200
4b8382af
Remove "Std" from StdCollectNum and StdExpiration.
Dmitry Chestnykh dmitry@codingrobots.com
Mon, 25 Apr 2011 23:35:53 +0200
dab96732
Add Store interface.

Standard storage is now known as memoryStore (created with
NewMemoryStore exported function). It's still default, however there's
now an option to replace it with a custom store by implementing Store
interface and calling SetCustomStore.
Dmitry Chestnykh dmitry@codingrobots.com
Mon, 25 Apr 2011 23:25:39 +0200
230b62a6
Add example HTTP server that uses the package.
Dmitry Chestnykh dmitry@codingrobots.com
Mon, 25 Apr 2011 17:34:47 +0200
fe4a5975
Thinner strike-through on captcha image.
Dmitry Chestnykh dmitry@codingrobots.com
Mon, 25 Apr 2011 12:26:12 +0200
8a2b5ae5
Add Audio.EncodedLen. Workaround for Chrome WAV bug.
Dmitry Chestnykh dmitry@codingrobots.com
Mon, 25 Apr 2011 02:16:01 +0200
d010e3f9
Add VerifyString function.
Dmitry Chestnykh dmitry@codingrobots.com
Mon, 25 Apr 2011 00:42:43 +0200
bd0535ea
Add CaptchaServer.
Dmitry Chestnykh dmitry@codingrobots.com
Sun, 24 Apr 2011 23:57:29 +0200
4572d7de
Fix comments, apply gofmt.
Dmitry Chestnykh dmitry@codingrobots.com
Sun, 24 Apr 2011 22:49:14 +0200
11dc0126
generate: rename to main.go, add Makefile.

Fix adding extra space in the generated sounds.go.
Dmitry Chestnykh dmitry@codingrobots.com
Sun, 24 Apr 2011 21:54:32 +0200
2ef763a3
Rename cmd to capgen, originals to generate.
Dmitry Chestnykh dmitry@codingrobots.com
Sun, 24 Apr 2011 21:45:37 +0200
5dd14861
Add captcha test.
Dmitry Chestnykh dmitry@codingrobots.com
Sun, 24 Apr 2011 16:09:55 +0200
8779418c
Add store test.
Dmitry Chestnykh dmitry@codingrobots.com
Sun, 24 Apr 2011 15:58:05 +0200
7b585d44
Fix collection (locking and getting next value).
Dmitry Chestnykh dmitry@codingrobots.com
Sun, 24 Apr 2011 15:53:45 +0200
90e4f749
newStore: accept collectNum and expiration time.

Prevoiusly, Expiration and CollectNum were hard-coded into store.go.
This change moves these constants to captcha.go (renaming to Std*), and
makes newStore accept them as arguments.

This will enable setting these paraments by package users sometime in
the future, if needed, and also allows testing of the store garbage
collection.
Dmitry Chestnykh dmitry@codingrobots.com
Sun, 24 Apr 2011 15:19:49 +0200
9de0d066
Add ErrNotFound, return it from WriteAudio/Image.
Dmitry Chestnykh dmitry@codingrobots.com
Sun, 24 Apr 2011 14:34:11 +0200
68d217e7
Export RandomDigits. Remove NewRandom* functions.
Dmitry Chestnykh dmitry@codingrobots.com
Sun, 24 Apr 2011 13:30:31 +0200
c179a205
Rename "numbers" to "digits" everywhere.

Plus fix comments.
Dmitry Chestnykh dmitry@codingrobots.com
Sun, 24 Apr 2011 13:23:17 +0200
2052308d
Set capacity for audio buffer. Rename makeStaticNoise to makeWhiteNoise.
Dmitry Chestnykh dmitry@codingrobots.com
Sun, 24 Apr 2011 12:56:02 +0200
874a3063
Rearrange code and fix docs.
Dmitry Chestnykh dmitry@codingrobots.com
Sat, 23 Apr 2011 21:20:12 +0200
8b932fcf
Implement a single captcha test command.

The new command replaces old test command-line utilities from cmd/image
and cmd/audio directories. It can now generate both image and audio
captchas, and accepts a few useful flags.

Edit .gitignore to reflect changes.
Dmitry Chestnykh dmitry@codingrobots.com
Sat, 23 Apr 2011 21:17:23 +0200
e40250a1
Add NewRandomAudio function.

Audio test cmd now writes to stdout.
Dmitry Chestnykh dmitry@codingrobots.com
Sat, 23 Apr 2011 18:53:26 +0200
79744759
Replace PNGEncode with WriteTo for Image.
Dmitry Chestnykh dmitry@codingrobots.com
Sat, 23 Apr 2011 18:48:58 +0200
e3eb2248
Add WriteAudio function.
Dmitry Chestnykh dmitry@codingrobots.com
Sat, 23 Apr 2011 18:44:02 +0200
5357b20f
Rename CaptchaImage -> Image, CaptchaAudio -> Audio.
Dmitry Chestnykh dmitry@codingrobots.com
Sat, 23 Apr 2011 18:41:00 +0200
82004bd9
Apply gofmt; fix comment in generate.go.
Dmitry Chestnykh dmitry@codingrobots.com
Sat, 23 Apr 2011 15:50:37 +0200
9ac4ea2b
Better randomize background and sounds.

Shorten intervals between prelude beeps.
Dmitry Chestnykh dmitry@codingrobots.com
Sat, 23 Apr 2011 15:41:48 +0200
45c2a02d
Lower level of beep sound.
Dmitry Chestnykh dmitry@codingrobots.com
Sat, 23 Apr 2011 15:39:51 +0200
8f4b2012
First version of audio captcha.
Dmitry Chestnykh dmitry@codingrobots.com
Sat, 23 Apr 2011 13:13:51 +0200
3586f91d
Move image generation test program to cmd/image.
Dmitry Chestnykh dmitry@codingrobots.com
Sat, 23 Apr 2011 11:24:17 +0200
778d34d6
image: move border calculation to calculateSizes().
Dmitry Chestnykh dmitry@codingrobots.com
Fri, 22 Apr 2011 00:05:19 +0200
452b826a
Fix comments.
Dmitry Chestnykh dmitry@codingrobots.com
Thu, 21 Apr 2011 23:43:47 +0200
b5845762
Move rand initialization to image.go.
Dmitry Chestnykh dmitry@codingrobots.com
Thu, 21 Apr 2011 23:08:58 +0200
8033b950
Clarify docs.
Dmitry Chestnykh dmitry@codingrobots.com
Thu, 21 Apr 2011 23:07:23 +0200
d36aa1f3
image: refactor; add more color variations.
Dmitry Chestnykh dmitry@codingrobots.com
Thu, 21 Apr 2011 22:43:25 +0200
aa0588b4
Refactor store into its own file.
Dmitry Chestnykh dmitry@codingrobots.com
Thu, 21 Apr 2011 22:28:52 +0200
0674e88f
Accept the length of the random sequence of numbers.
Dmitry Chestnykh dmitry@codingrobots.com
Thu, 21 Apr 2011 18:18:00 +0200
f9f7db1f
Call Collect on a separate goroutine.
Dmitry Chestnykh dmitry@codingrobots.com
Thu, 21 Apr 2011 18:14:28 +0200
59a641ef
Update documentation.
Dmitry Chestnykh dmitry@codingrobots.com
Thu, 21 Apr 2011 18:05:53 +0200
cbab3d06
cmd: use standard width and height for image.
Dmitry Chestnykh dmitry@codingrobots.com
Thu, 21 Apr 2011 17:53:34 +0200
01012728
Document functions and types in captcha.go.
Dmitry Chestnykh dmitry@codingrobots.com
Thu, 21 Apr 2011 17:53:08 +0200
bb39fc5c
Refactored image captcha ready, and documented.
Dmitry Chestnykh dmitry@codingrobots.com
Thu, 21 Apr 2011 17:41:44 +0200
f1572d4d
Numbers are now laid out correctly.

Next commits will introduce perturbations.
Dmitry Chestnykh dmitry@codingrobots.com
Thu, 21 Apr 2011 16:48:12 +0200
d88ce819
Started work on code cleanup.
Dmitry Chestnykh dmitry@codingrobots.com
Thu, 21 Apr 2011 01:12:31 +0200
9da9f1ad
Gofmt font.go.
Dmitry Chestnykh dmitry@codingrobots.com
Wed, 20 Apr 2011 13:18:51 +0200
364b4304
Move image-related functions into image.go.
Dmitry Chestnykh dmitry@codingrobots.com
Wed, 20 Apr 2011 03:14:29 +0200
b04efdcc
Add line that strikes through digits.
Dmitry Chestnykh dmitry@codingrobots.com
Wed, 20 Apr 2011 03:05:45 +0200
caf79f3b
Reorganize code. Add storage.
Dmitry Chestnykh dmitry@codingrobots.com
Wed, 20 Apr 2011 01:24:30 +0200
69b50fb6
Initial version (numbers).
Dmitry Chestnykh dmitry@codingrobots.com
Tue, 19 Apr 2011 20:32:40 +0200
d8b1fe6a
Fix typo.
Michael Gehring mg@ebfe.org
Wed, 11 Dec 2013 16:14:40 +0100
a5414934
Update README.md
Yusheng sniky.hack@gmail.com
Tue, 28 Jul 2015 10:33:19 +0800
2939eaa0
Update Chinese sounds and background sound level
vapehacker me@icyu.me
Sat, 16 Jul 2022 17:24:16 +0800