net.bryansaunders.jee6divelog.util
Class HashUtils

java.lang.Object
  extended by net.bryansaunders.jee6divelog.util.HashUtils

public final class HashUtils
extends java.lang.Object

Utility Methods for Dealing with Hashing.

Author:
Bryan Saunders

Method Summary
static java.lang.String base64Decode(java.lang.String stringToDecode)
          Decodes a Base64 string.
static java.lang.String base64Encode(java.lang.String stringToEncode)
          Encodes a string as Base64.
static java.lang.String toHmacSha1(java.lang.String stringToHash, java.lang.String key)
          Generates a HMAC-SHA1 Hash of the given String using the specified key.
static java.lang.String toSha256(java.lang.String stringToHash)
          Hashes the string using SHA-256 Algorithim.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

toSha256

public static java.lang.String toSha256(java.lang.String stringToHash)
Hashes the string using SHA-256 Algorithim.

Parameters:
stringToHash - String to hash
Returns:
Hashed String

base64Encode

public static java.lang.String base64Encode(java.lang.String stringToEncode)
Encodes a string as Base64.

Parameters:
stringToEncode - String to encode
Returns:
Encoded String

base64Decode

public static java.lang.String base64Decode(java.lang.String stringToDecode)
Decodes a Base64 string.

Parameters:
stringToDecode - String to decode
Returns:
Decoded String

toHmacSha1

public static java.lang.String toHmacSha1(java.lang.String stringToHash,
                                          java.lang.String key)
Generates a HMAC-SHA1 Hash of the given String using the specified key.

Parameters:
stringToHash - String to Hash
key - Key to Sign the String with
Returns:
Hashed String


Copyright © 2012 Bryan Saunders. All Rights Reserved.