public class ZipBinaryImageCaptchaClient extends java.lang.Object implements IImageEncodedCaptcha
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CAPTCHA_DATA_FORMAT
This is the captcha format identifier for the class of captchas, which can be handled by
this class implementation.
|
private MyImage |
m_captchaImage
Stores the captcha image.
|
private int |
m_captchaKeyBits
Stores the number of captcha key bits.
|
private int |
m_characterNumber
Stores the number of characters, which are embedded in the captcha image.
|
private java.lang.String |
m_characterSet
Stores the character set, which was used when the captcha was created.
|
private byte[] |
m_encodedData
Stores the encoded information.
|
private int |
m_extraKeyBits
Stores the number of extra key bits (bits of the key, which we have to guess with brute
force).
|
Constructor and Description |
---|
ZipBinaryImageCaptchaClient(org.w3c.dom.Element a_captchaEncodedNode)
Creates a new instance of ZipBinaryImageClient, which handles all captchas of the
"ZIP_BINARY_IMAGE" format.
|
Modifier and Type | Method and Description |
---|---|
private byte[] |
generateNextKey(byte[] a_currentKey,
int a_mod8KeyBits)
Generates the next key, which is equal to the current key + 1.
|
int |
getCharacterNumber()
Returns the number of characters which are included in the captcha.
|
java.lang.String |
getCharacterSet()
Returns the character set which was used when the captcha was created.
|
MyImage |
getImage()
Returns the image with the captcha data.
|
byte[] |
solveCaptcha(java.lang.String a_key,
byte[] a_startsWith)
Solves the captcha and returns the encoded information.
|
public static final java.lang.String CAPTCHA_DATA_FORMAT
private MyImage m_captchaImage
private int m_captchaKeyBits
private int m_extraKeyBits
private java.lang.String m_characterSet
private int m_characterNumber
private byte[] m_encodedData
public ZipBinaryImageCaptchaClient(org.w3c.dom.Element a_captchaEncodedNode) throws java.lang.Exception
a_captchaEncodedNode
- The CaptchaEncoded node with the data of a "ZIP_BINARY_IMAGE"
captcha.java.lang.Exception
public MyImage getImage()
getImage
in interface IImageEncodedCaptcha
public java.lang.String getCharacterSet()
getCharacterSet
in interface IImageEncodedCaptcha
public int getCharacterNumber()
getCharacterNumber
in interface IImageEncodedCaptcha
public byte[] solveCaptcha(java.lang.String a_key, byte[] a_startsWith) throws java.lang.Exception
solveCaptcha
in interface IImageEncodedCaptcha
a_key
- The key for solving the captcha (it's the string which is shown in the captcha
image).a_startsWith
- byte[]java.lang.Exception
private byte[] generateNextKey(byte[] a_currentKey, int a_mod8KeyBits) throws java.lang.Exception
a_currentKey
- The current key, you should start with 000...000.a_mod8KeyBits
- This is the number of key bits mod 8 in the current key. This value
describes how many bits of the highest order byte are used (attention:
a value of 0 means, that all bits are used).java.lang.Exception
Copyright © 2023. All rights reserved.