Awake SQL v1.2.1

org.awakefw.commons.api.server.util
Class Sha1

java.lang.Object
  extended by org.awakefw.commons.api.server.util.Sha1

public class Sha1
extends Object

SHA-1 hash functions on strings and files with SUN provider.


Constructor Summary
Sha1()
          Constructor.
 
Method Summary
 byte[] getFileHash(File file)
          Gets the a file hash value.
 byte[] getHash(byte[] b)
          Computes the SHA-1 hash code of a byte array as an hex string.
 String getHexFileHash(File file)
          Gets the file hash as an hex string value.
 String getHexHash(byte[] b)
          Computes the hash code of a byte array as an hex string.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Sha1

public Sha1()
Constructor.

Method Detail

getFileHash

public byte[] getFileHash(File file)
                   throws IOException,
                          NoSuchAlgorithmException,
                          NoSuchProviderException
Gets the a file hash value.

Parameters:
file - the file to hash
Returns:
the file hash as bytes
Throws:
IOException - an I/O error occurred
NoSuchAlgorithmException - hash algorithm not found
NoSuchProviderException - hash provider not found

getHash

public byte[] getHash(byte[] b)
               throws NoSuchAlgorithmException,
                      NoSuchProviderException
Computes the SHA-1 hash code of a byte array as an hex string.

Parameters:
b - the bytes to hash
Returns:
the hash value
Throws:
NoSuchAlgorithmException - if the algorithm is not available from the provide
NoSuchProviderException - if the provider is not available in the environment

getHexFileHash

public String getHexFileHash(File file)
                      throws IOException,
                             NoSuchAlgorithmException,
                             NoSuchProviderException
Gets the file hash as an hex string value.

Parameters:
file - the file to hash
Returns:
the file hash as an hex string
Throws:
IOException - an I/O error occurred
NoSuchAlgorithmException - hash algorithm not found
NoSuchProviderException - hash provider not found

getHexHash

public String getHexHash(byte[] b)
                  throws NoSuchAlgorithmException,
                         NoSuchProviderException
Computes the hash code of a byte array as an hex string.

Parameters:
b - the bytes to hash
Returns:
the hash value in hex String
Throws:
NoSuchAlgorithmException - if the algorithm is not available from the provider
NoSuchProviderException - if the provider is not available in the environment

Awake SQL v1.2.1

Awake SQL - Virtual JDBC Driver over HTTP for Android, Swing and JavaFX
Android & Desktop Edition allow easy access to majors remote SQL databases with regular JDBC calls:
DB2 - H2 - HSQLDB (HyperSQL) - Informix - Ingres - MySQL - Oracle - PostgreSQL - SQL Server - Sybase - Teradata
Copyright © 2012 Kawan Softwares SAS