Coverage Report - org.apache.shiro.crypto.hash.Sha384Hash
 
Classes in this File Line Coverage Branch Coverage Complexity
Sha384Hash
14%
2/14
N/A
1
 
 1  
 /*
 2  
  * Licensed to the Apache Software Foundation (ASF) under one
 3  
  * or more contributor license agreements.  See the NOTICE file
 4  
  * distributed with this work for additional information
 5  
  * regarding copyright ownership.  The ASF licenses this file
 6  
  * to you under the Apache License, Version 2.0 (the
 7  
  * "License"); you may not use this file except in compliance
 8  
  * with the License.  You may obtain a copy of the License at
 9  
  *
 10  
  *     http://www.apache.org/licenses/LICENSE-2.0
 11  
  *
 12  
  * Unless required by applicable law or agreed to in writing,
 13  
  * software distributed under the License is distributed on an
 14  
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 15  
  * KIND, either express or implied.  See the License for the
 16  
  * specific language governing permissions and limitations
 17  
  * under the License.
 18  
  */
 19  
 package org.apache.shiro.crypto.hash;
 20  
 
 21  
 import org.apache.shiro.codec.Base64;
 22  
 import org.apache.shiro.codec.Hex;
 23  
 
 24  
 
 25  
 /**
 26  
  * Generates an SHA-384 Hash from a given input <tt>source</tt> with an optional <tt>salt</tt> and hash iterations.
 27  
  * <p/>
 28  
  * See the {@link SimpleHash SimpleHash} parent class JavaDoc for a detailed explanation of Hashing
 29  
  * techniques and how the overloaded constructors function.
 30  
  * <p/>
 31  
  * <b>JDK Version Note</b> - Attempting to instantiate this class on JREs prior to version 1.4.0 will throw
 32  
  * an {@link IllegalStateException IllegalStateException}
 33  
  *
 34  
  * @since 0.9
 35  
  */
 36  
 public class Sha384Hash extends SimpleHash {
 37  
 
 38  
     //TODO - complete JavaDoc
 39  
 
 40  
     public static final String ALGORITHM_NAME = "SHA-384";
 41  
 
 42  
     public Sha384Hash() {
 43  0
         super(ALGORITHM_NAME);
 44  0
     }
 45  
 
 46  
     public Sha384Hash(Object source) {
 47  1
         super(ALGORITHM_NAME, source);
 48  1
     }
 49  
 
 50  
     public Sha384Hash(Object source, Object salt) {
 51  0
         super(ALGORITHM_NAME, source, salt);
 52  0
     }
 53  
 
 54  
     public Sha384Hash(Object source, Object salt, int hashIterations) {
 55  0
         super(ALGORITHM_NAME, source, salt, hashIterations);
 56  0
     }
 57  
 
 58  
     public static Sha384Hash fromHexString(String hex) {
 59  0
         Sha384Hash hash = new Sha384Hash();
 60  0
         hash.setBytes(Hex.decode(hex));
 61  0
         return hash;
 62  
     }
 63  
 
 64  
     public static Sha384Hash fromBase64String(String base64) {
 65  0
         Sha384Hash hash = new Sha384Hash();
 66  0
         hash.setBytes(Base64.decode(base64));
 67  0
         return hash;
 68  
     }
 69  
 }