com.biuqu.encryptor.impl.ShaHashEncryptor Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of bq-encryptor Show documentation
Show all versions of bq-encryptor Show documentation
easy use for mostly encryption
The newest version!
package com.biuqu.encryptor.impl;
import com.biuqu.encryption.BaseHash;
import com.biuqu.encryption.factory.EncryptionFactory;
import com.biuqu.encryptor.BaseHashEncryptor;
import com.biuqu.encryptor.model.EncryptorKey;
import org.apache.commons.lang3.StringUtils;
/**
* 默认的Hash摘要器
*
* @author BiuQu
* @date 2023/5/3 00:29
*/
public class ShaHashEncryptor extends BaseHashEncryptor
{
public ShaHashEncryptor(EncryptorKey key)
{
this.setHash(EncryptionFactory.SHAHash.createAlgorithm());
if (null != key && !StringUtils.isEmpty(key.getHashAlg()))
{
//更新SHA Hash算法的类型
((BaseHash)this.getHash()).setAlgorithm(key.getHashAlg());
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy