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 module hunt.shiro.crypto.hash.ConfigurableHashService; 20 21 import hunt.shiro.crypto.hash.HashService; 22 23 import hunt.shiro.crypto.RandomNumberGenerator; 24 import hunt.shiro.util.ByteSource; 25 26 /** 27 * A {@code HashService} that allows configuration of its strategy via JavaBeans-compatible setter methods. 28 * 29 */ 30 interface ConfigurableHashService : HashService { 31 32 /** 33 * Sets the 'private' (internal) salt to be paired with a 'public' (random or supplied) salt during hash computation. 34 * 35 * @param privateSalt the 'private' internal salt to be paired with a 'public' (random or supplied) salt during 36 * hash computation. 37 */ 38 void setPrivateSalt(ByteSource privateSalt); 39 40 /** 41 * Sets the number of hash iterations that will be performed during hash computation. 42 * 43 * @param iterations the number of hash iterations that will be performed during hash computation. 44 */ 45 void setHashIterations(int iterations); 46 47 /** 48 * Sets the name of the {@link java.security.MessageDigest MessageDigest} algorithm that will be used to compute 49 * hashes. 50 * 51 * @param name the name of the {@link java.security.MessageDigest MessageDigest} algorithm that will be used to 52 * compute hashes. 53 */ 54 void setHashAlgorithmName(string name); 55 56 /** 57 * Sets a source of randomness used to generate public salts that will in turn be used during hash computation. 58 * 59 * @param rng a source of randomness used to generate public salts that will in turn be used during hash computation. 60 */ 61 void setRandomNumberGenerator(RandomNumberGenerator rng); 62 }