kettle加解密算法

package sjck;
import java.math.BigInteger; 

public class JM {
    private static  int RADIX = 16; 
    private static  String SEED = "0933910847463829827159347601486730416058"; 
    
    public static final String encryptPassword(String password)  
    {  
        if (password==null) return "";  
        if (password.length()==0) return "";  
          
        BigInteger bi_passwd = new BigInteger(password.getBytes());  
          
        BigInteger bi_r0  = new BigInteger(SEED);  
        BigInteger bi_r1  = bi_r0.xor(bi_passwd);  
          
        return bi_r1.toString(RADIX);   
    }  
    
    
    public static  String decryptPassword(String encrypted) 
    { 
             if (encrypted==null) return ""; 
             if (encrypted.length()==0) return ""; 
              
             BigInteger bi_confuse  = new BigInteger(SEED); 
              
             try 
             { 
                     BigInteger bi_r1 = new BigInteger(encrypted, RADIX); 
                     BigInteger bi_r0 = bi_r1.xor(bi_confuse); 
                      
                     return new String(bi_r0.toByteArray());  
             } 
             catch(Exception e) 
             { 
                     return ""; 
             } 
     } 

	public static void main(String[] args) {
		System.out.println(JM.decryptPassword("2be98afc86aa7c3d6f848fc238bc6fd99"));
	}
}


 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Kettle中,可以使用加密组件对敏感信息进行加密解密。可以使用AES算法对数据进行加密。在Kettle中,使用的是对称加密,需要提供一个密钥。密钥可以在MySQL中生成,使用以下SQL语句:select hex('1234567890adbcde')。生成的密钥可以在Kettle中配置。 具体的操作步骤如下: 1. 导入Kettle的相关库和类。 2. 在代码中使用KettleEnvironment.init()初始化Kettle环境。 3. 定义待加密的密码。 4. 使用Encr.decryptPassword()方法对密码进行解密。 示例代码如下: import org.pentaho.di.core.KettleEnvironment; import org.pentaho.di.core.encryption.Encr; import org.pentaho.di.core.exception.KettleException; public class CrackPwd { public static void main(String[] args) { try { KettleEnvironment.init(); String pwd = "Encrypted 2be98afc86aa7f2e4cb79f62886caf782"; System.out.println("解码前密码:" + pwd); String decryptPassword = Encr.decryptPassword(pwd); System.out.println("解码后密码:" + decryptPassword); } catch (KettleException e) { e.printStackTrace(); } } } 这样就可以对Kettle中的加密密码进行解密操作了。注意,使用Kettle进行加密解密时,需要确保密钥的安全性和正确性。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* [kettle 数据库密码解密](https://blog.csdn.net/dong__CSDN/article/details/123877985)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"] - *2* *3* [kettle使用java脚本对数据进行加密解密详解](https://blog.csdn.net/weixin_39040527/article/details/106813294)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值