|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.kde.koala.KMD5
public class KMD5
The default constructor is designed to provide much the same functionality as the most commonly used C-implementation, while the other three constructors are meant to further simplify the process of obtaining a digest by calculating the result in a single step. KMD5 is state-based, that means you can add new contents with update() as long as you didn't request the digest value yet. After the digest value was requested, the object is "finalized" and you have to call reset() to be able to do another calculation with it. The reason for this behavior is that upon requesting the message digest KMD5 has to pad the received contents up to a 64 byte boundary to calculate its value. After this operation it is not possible to resume consuming data. sage: A common usage of this class:
String test1; KMD5.Digest rawResult; test1 = "This is a simple test."; KMD5 context (test1); cout << "Hex Digest output: " << context.hexDigest().data() << endl;To cut down on the unnecessary overhead of creating multiple KMD5 objects, you can simply invoke reset() to reuse the same object in making another calculation:
context.reset (); context.update ("TWO"); context.update ("THREE"); cout << "Hex Digest output: " << context.hexDigest().data() << endl;
Constructor Summary | |
---|---|
|
KMD5()
|
|
KMD5(byte[] a)
|
protected |
KMD5(java.lang.Class dummy)
|
|
KMD5(java.lang.String in)
|
|
KMD5(java.lang.String in,
int len)
Constructor that updates the digest for the given string. |
Method Summary | |
---|---|
java.lang.String |
base64Digest()
Returns the value of the calculated message digest in a base64-encoded representation. |
void |
dispose()
Delete the wrapped C++ instance ahead of finalize() |
protected void |
finalize()
Deletes the wrapped C++ instance |
protected void |
finalizeDigest()
finalizes the digest |
java.lang.String |
hexDigest()
Returns the value of the calculated message digest in a hexadecimal representation. |
void |
hexDigest(java.lang.StringBuffer arg1)
|
boolean |
isDisposed()
Has the wrapped C++ instance been deleted? |
void |
reset()
Calling this function will reset the calculated message digest. |
void |
update(byte[] in)
|
boolean |
update(org.kde.qt.QIODevice file)
|
void |
update(short in)
|
void |
update(short in,
int len)
|
void |
update(java.lang.String in)
|
void |
update(java.lang.String in,
int len)
Updates the message to be digested. |
boolean |
verify(java.lang.String arg1)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected KMD5(java.lang.Class dummy)
public KMD5()
public KMD5(java.lang.String in, int len)
in
- C string or binary datalen
- if negative, calculates the length by using
strlen on the first parameter, otherwise
it trusts the given length (does not stop on NUL byte).public KMD5(java.lang.String in)
public KMD5(byte[] a)
Method Detail |
---|
public void update(java.lang.String in, int len)
in
- message to be added to digestlen
- the length of the given message.public void update(java.lang.String in)
public void update(short in, int len)
public void update(short in)
public void update(byte[] in)
in
- message to be added to the digest (byte[]).public boolean update(org.kde.qt.QIODevice file)
file
- a pointer to FILE as returned by calls like f{d,re}open
public void reset()
public java.lang.String hexDigest()
public void hexDigest(java.lang.StringBuffer arg1)
public java.lang.String base64Digest()
public boolean verify(java.lang.String arg1)
protected void finalizeDigest()
protected void finalize() throws java.lang.InternalError
finalize
in class java.lang.Object
java.lang.InternalError
public void dispose()
public boolean isDisposed()
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |