all repos — captcha @ 31461913baa731d3b683912c0f01441dfc9a2ca1

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

Gofmt; make capgensound produce gofmt'ed output.
Dmitry Chestnykh dmitry@codingrobots.com
Mon, 12 May 2014 14:40:09 +0200
commit

31461913baa731d3b683912c0f01441dfc9a2ca1

parent

90158fbef436f84faed8891b2e525241142bd6a9

4 files changed, 5 insertions(+), 6 deletions(-)

jump to
M capgensounds/main.gocapgensounds/main.go

@@ -57,7 +57,7 @@ fmt.Fprintf(pcm, "}\n")

} func writeDigitSounds(pcm io.Writer, lang string) { - fmt.Fprintf(pcm, "\t\"%s\" : [][]byte{\n", lang) + fmt.Fprintf(pcm, "\t\"%s\": [][]byte{\n", lang) for i := 0; i <= 9; i++ { fmt.Fprintf(pcm, "\t\t{ // %d\n\t\t\t", i) writeFileRep(pcm, filepath.Join(lang, fmt.Sprintf("%d.wav", i)), "\t\t\t")
M captcha.gocaptcha.go

@@ -128,7 +128,7 @@ }

// Verify returns true if the given digits are the ones that were used to // create the given captcha id. -// +// // The function deletes the captcha with the given id from the internal // storage, so that the same captcha can't be verified anymore. func Verify(id string, digits []byte) bool {
M sounds.gosounds.go

@@ -12,7 +12,7 @@

// Byte slices contain raw 8 kHz unsigned 8-bit PCM data (without wav header). var digitSounds = map[string][][]byte{ - "en" : [][]byte{ + "en": [][]byte{ { // 0 0x80, 0x7f, 0x80, 0x7f, 0x80, 0x80, 0x80, 0x7f, 0x80, 0x7f, 0x80, 0x7f, 0x80, 0x7f, 0x80, 0x7f, 0x80, 0x7f, 0x80, 0x80, 0x7f, 0x80,

@@ -2142,7 +2142,7 @@ 0x80, 0x7f, 0x80, 0x7f, 0x80, 0x80, 0x80, 0x7f, 0x80, 0x7f, 0x80,

0x80, 0x7f, 0x80, 0x7f, 0x80, 0x80, 0x7f, 0x80, 0x7f, }, }, - "ru" : [][]byte{ + "ru": [][]byte{ { // 0 0x7f, 0x7f, 0x7e, 0x7f, 0x7f, 0x7e, 0x7f, 0x7e, 0x7f, 0x7f, 0x7e, 0x7f, 0x7e, 0x7f, 0x7d, 0x7e, 0x7d, 0x7e, 0x7e, 0x7e, 0x7d, 0x7e,

@@ -4607,7 +4607,7 @@ 0x7f, 0x7e, 0x80, 0x7f, 0x7f, 0x80, 0x7f, 0x80, 0x80, 0x7f, 0x80,

0x80, 0x7f, 0x80, 0x80, 0x7f, 0x80, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, }, }, - "zh" : [][]byte{ + "zh": [][]byte{ { // 0 0x7f, 0x80, 0x7f, 0x80, 0x80, 0x7f, 0x80, 0x7f, 0x80, 0x7f, 0x80, 0x7f, 0x80, 0x7f, 0x7f, 0x80, 0x7f, 0x80, 0x7f, 0x80, 0x7f, 0x80,
M store_test.gostore_test.go

@@ -61,7 +61,6 @@ t.Errorf("= not collected %d out of %d captchas", nc, len(ids))

} } - func BenchmarkSetCollect(b *testing.B) { b.StopTimer() d := RandomDigits(10)