Coverage Report - org.apache.shiro.crypto.hash.Hash
 
Classes in this File Line Coverage Branch Coverage Complexity
Hash
N/A
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.util.ByteSource;
 22  
 
 23  
 /**
 24  
  * A Cryptographic {@code Hash} represents a one-way conversion algorithm that transforms an input source to an
 25  
  * underlying byte array.  Hex and Base64-encoding output of the hashed bytes are automatically supported by the
 26  
  * inherited {@link #toHex() toHex()} and {@link #toBase64() toBase64()} methods.
 27  
  * <p/>
 28  
  * The bytes returned by the parent interface's {@link #getBytes() getBytes()} are the hashed value of the
 29  
  * original input source, also known as the 'checksum' or 'digest'.
 30  
  *
 31  
  * @see Md2Hash
 32  
  * @see Md5Hash
 33  
  * @see Sha1Hash
 34  
  * @see Sha256Hash
 35  
  * @see Sha384Hash
 36  
  * @see Sha512Hash
 37  
  * @since 0.9
 38  
  */
 39  
 public interface Hash extends ByteSource {
 40  
 
 41  
     /**
 42  
      * Returns the name of the algorithm used to hash the input source, for example, {@code SHA-256}, {@code MD5}, etc.
 43  
      * <p/>
 44  
      * The name is expected to be a {@link java.security.MessageDigest MessageDigest} algorithm name.
 45  
      *
 46  
      * @return the the name of the algorithm used to hash the input source, for example, {@code SHA-256}, {@code MD5}, etc.
 47  
      * @since 1.1
 48  
      */
 49  
     String getAlgorithmName();
 50  
 
 51  
     /**
 52  
      * Returns a salt used to compute the hash or {@code null} if no salt was used.
 53  
      *
 54  
      * @return a salt used to compute the hash or {@code null} if no salt was used.
 55  
      * @since 1.2
 56  
      */
 57  
     ByteSource getSalt();
 58  
 
 59  
     /**
 60  
      * Returns the number of hash iterations used to compute the hash.
 61  
      *
 62  
      * @return the number of hash iterations used to compute the hash.
 63  
      * @since 1.2
 64  
      */
 65  
     int getIterations();
 66  
 
 67  
 }