Class Skein512
- All Implemented Interfaces:
Digest
public class Skein512 extends Object
This class implements the Skein-512 digest algorithm under the
Digest API. In the Skein specification, that function is
called under the full name "Skein-512-512".
==========================(LICENSE BEGIN)============================ Copyright (c) 2007-2010 Projet RNRT SAPHIR Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ===========================(LICENSE END)=============================
- Version:
- $Revision: 253 $
- Author:
- Thomas Pornin <thomas.pornin@cryptolog.com>
-
Constructor Summary
Constructors Constructor Description Skein512()Create the engine. -
Method Summary
Modifier and Type Method Description Digestcopy()Clone the current state.byte[]digest()Finalize the current hash computation and return the hash value in a newly-allocated array.byte[]digest(byte[] inbuf)Input some bytes, then finalize the current hash computation and return the hash value in a newly-allocated array.intdigest(byte[] outbuf, int off, int len)Finalize the current hash computation and store the hash value in the provided output buffer.intgetBlockLength()Return the "block length" for the hash function.intgetDigestLength()Get the natural hash function output length (in bytes).voidreset()Reset the object: this makes it suitable for a new hash computation.StringtoString()Get the display name for this function (e.g.voidupdate(byte in)Insert one more input data byte.voidupdate(byte[] inbuf)Insert some more bytes.voidupdate(byte[] inbuf, int off, int len)Insert some more bytes.
-
Constructor Details
-
Skein512
public Skein512()Create the engine.
-
-
Method Details
-
getDigestLength
public int getDigestLength()Description copied from interface:DigestGet the natural hash function output length (in bytes).- Returns:
- the digest output length (in bytes)
- See Also:
Digest
-
update
public void update(byte in)Description copied from interface:DigestInsert one more input data byte. -
update
public void update(byte[] inbuf)Description copied from interface:DigestInsert some more bytes. -
update
public void update(byte[] inbuf, int off, int len)Description copied from interface:DigestInsert some more bytes. -
digest
public byte[] digest()Description copied from interface:DigestFinalize the current hash computation and return the hash value in a newly-allocated array. The object is resetted. -
digest
public byte[] digest(byte[] inbuf)Description copied from interface:DigestInput some bytes, then finalize the current hash computation and return the hash value in a newly-allocated array. The object is resetted. -
digest
public int digest(byte[] outbuf, int off, int len)Description copied from interface:DigestFinalize the current hash computation and store the hash value in the provided output buffer. Thelenparameter contains the maximum number of bytes that should be written; no more bytes than the natural hash function output length will be produced. Iflenis smaller than the natural hash output length, the hash output is truncated to its firstlenbytes. The object is resetted. -
reset
public void reset()Description copied from interface:DigestReset the object: this makes it suitable for a new hash computation. The current computation, if any, is discarded. -
copy
Description copied from interface:DigestClone the current state. The returned object evolves independantly of this object. -
getBlockLength
public int getBlockLength()Description copied from interface:DigestReturn the "block length" for the hash function. This value is naturally defined for iterated hash functions (Merkle-Damgard). It is used in HMAC (that's what the HMAC specification names the "
B" parameter).If the function is "block-less" then this function may return
-nwherenis an integer such that the block length for HMAC ("B") will be inferred from the key length, by selecting the smallest multiple ofnwhich is no smaller than the key length. For instance, for the Fugue-xxx hash functions, this function returns -4: the virtual block length B is the HMAC key length, rounded up to the next multiple of 4.- Specified by:
getBlockLengthin interfaceDigest- Returns:
- the internal block length (in bytes), or
-n - See Also:
Digest
-
toString
Description copied from interface:DigestGet the display name for this function (e.g.
"SHA-1"for SHA-1).
-