package jp.agentec.abook.abv.bl.common.zip;

import java.security.NoSuchAlgorithmException;

import jp.agentec.adf.security.cryptography.MD5;
import jp.agentec.adf.util.StringUtil;

// 現在未使用
public class ZipKey  {
	
	public static final String ZipPasswordPrefix = "ABook+";		//	ABook+コンテンツID
	
	public static void main(String[] args) throws NoSuchAlgorithmException{
		ZipKeyPrint();
	}
	
	private static void ZipKeyPrint() {
		try{
			//ログインＩＤを定義する。
			String[] logId = {"as"}; 
			for (int i = 0 ; i < logId.length ; i++) {
				System.out.println(logId[i] + " = " +  getOutZipPassword(logId[i], ZipPasswordPrefix));
			}
		  }
		  catch(Exception e) {
		      System.out.println(e.toString()); //  TODO later　
		  }
	}
	
	public static String getOutZipPassword(String loginId, String passwordPrefix) throws NoSuchAlgorithmException {
		String password = null;
		
		if (!StringUtil.isNullOrWhiteSpace(passwordPrefix)) {
			password = MD5.getMd5Hash(passwordPrefix + StringUtil.toString(loginId)).toUpperCase();
		}
		
		return password;
	}
	
	
}