|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.littleshoot.util.Sha1Hasher
public final class Sha1Hasher
Utility class for generating SHA-1 file hashes. Formats SHA-1s as URNs, as specified in RFC 2141 and according to MAGNET conventions.
| Method Summary | |
|---|---|
static URI |
createSha1Urn(byte[] buf)
Create a new SHA1 hash URI for the specified ByteBuffer. |
static URI |
createSha1Urn(ByteBuffer buf)
Create a new SHA1 hash URI for the specified ByteBuffer. |
static URI |
createSha1Urn(File file)
Create a new SHA1 hash URI for the specified file on disk. |
static URI |
createSha1Urn(InputStream is)
Create a new SHA1 hash URI for the specified InputStream. |
static URI |
createSha1Urn(InputStream is,
MessageDigest md)
Create a new SHA1 hash URI for the specified InputStream. |
static String |
hash(String str)
Creates a base 64 encoded SHA-1 hash of the specified string. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static URI createSha1Urn(File file)
throws IOException
file - the file to construct the hash from
IOException - If there is an error creating the hash or if the
specified algorithm cannot be found.
public static URI createSha1Urn(byte[] buf)
throws IOException
ByteBuffer.
buf - The bytes to create the SHA-1 for.
IOException - If there is an error creating the hash or if the
specified algorithm cannot be found.
public static URI createSha1Urn(ByteBuffer buf)
throws IOException
ByteBuffer.
buf - The ByteBuffer to create the SHA-1 for.
IOException - If there is an error creating the hash or if the
specified algorithm cannot be found.
public static URI createSha1Urn(InputStream is)
throws IOException
InputStream.
is - The InputStream to create the SHA-1 for.
IOException - If there is an error creating the hash or if the
specified algorithm cannot be found.
public static URI createSha1Urn(InputStream is,
MessageDigest md)
throws IOException
InputStream.
is - The InputStream to create the SHA-1 for.md - The MessageDigest class to use.
IOException - If there is an error creating the hash or if the
specified algorithm cannot be found.public static String hash(String str)
str - The string to hash.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||