// Path: cryptocard/src/main/java/com/indarsoft/cryptocard/symmetrickey/Pvk.java
// public class Pvk extends DesKey {
// 
// 	private int pvki ;
// 	/**
// 	 * PVK constructor
// 	 * @param aKey	DES key double length.
// 	 * @param pvki	pvki
// 	 * @throws DesKeyException if a exception arrives
// 	 */
// 	public Pvk (String aKey ,  int pvki  ) throws DesKeyException  {
// 		
// 		 super(aKey );
// 		 if ( ! validatePvki ( pvki ) ) throw new DesKeyException("Wrong Key - pvki must be Decimal between 1 and six !!") ;
// 		 /*
// 		  * Do not enforce this, because PVK is also used for IBM3264offset method
// 		  */
// 		 //if ( aKey.length() != 32 )  	throw new DesKeyException("Wrong Key - DOUBLE deskey Must be 32 long Hexadecimal data!!");
// 		 this.pvki = pvki ;
// 	}
// 	/**
// 	 * PVK constructor with default pvki = 1.
// 	 * @param aKey	DES key double length
// 	 * @throws DesKeyException if a exception arrives
// 	 */
// 	public Pvk (String aKey  ) throws DesKeyException  {
// 		
// 		 this (aKey, 1 );
// 	}
// 	
// 	public int getPvki () {
// 		return this.pvki ;				
// 	}
// 	
// 	private static Boolean validatePvki ( int pvki ){
// 		
// 		if ( pvki < 1 || pvki > 6 ){
// 			return false ;	
// 		}
// 		return true ;
// 	}		
// 	
// }
// 
// Path: cryptocard/src/main/java/com/indarsoft/cryptocard/types/DesKeyType.java
// public enum DesKeyType {
// 
// 	SIMPLE(0), DOUBLE(1), TRIPLE(2) ;
//     @SuppressWarnings("unused")
// 	private int value;
// 
//     private DesKeyType (int value) {
//             this.value = value;
//     }	
// }


import com.indarsoft.cryptocard.symmetrickey.Pvk;
import com.indarsoft.cryptocard.types.DesKeyType;
import com.indarsoft.utl.Ascii;
import com.indarsoft.utl.Binary;
import com.indarsoft.utl.Des;

package com.indarsoft.cryptocard.customerverify;

/**
 * Performs IBM3624 offset calculations.
 * 
 * @author fjavier.porras@gmail.com
 *
 */
public class Ibm3624Offset  {

	private static final int  BLK16  = 	16  ; //  (16 * 8 = 128 bits )
	private static final int  BLK08  = 	8   ; //  (8  * 8 = 64 bits )

// Path: cryptocard/src/main/java/com/indarsoft/cryptocard/symmetrickey/Pvk.java
// public class Pvk extends DesKey {
// 
// 	private int pvki ;
// 	/**
// 	 * PVK constructor
// 	 * @param aKey	DES key double length.
// 	 * @param pvki	pvki
// 	 * @throws DesKeyException if a exception arrives
// 	 */
// 	public Pvk (String aKey ,  int pvki  ) throws DesKeyException  {
// 		
// 		 super(aKey );
// 		 if ( ! validatePvki ( pvki ) ) throw new DesKeyException("Wrong Key - pvki must be Decimal between 1 and six !!") ;
// 		 /*
// 		  * Do not enforce this, because PVK is also used for IBM3264offset method
// 		  */
// 		 //if ( aKey.length() != 32 )  	throw new DesKeyException("Wrong Key - DOUBLE deskey Must be 32 long Hexadecimal data!!");
// 		 this.pvki = pvki ;
// 	}
// 	/**
// 	 * PVK constructor with default pvki = 1.
// 	 * @param aKey	DES key double length
// 	 * @throws DesKeyException if a exception arrives
// 	 */
// 	public Pvk (String aKey  ) throws DesKeyException  {
// 		
// 		 this (aKey, 1 );
// 	}
// 	
// 	public int getPvki () {
// 		return this.pvki ;				
// 	}
// 	
// 	private static Boolean validatePvki ( int pvki ){
// 		
// 		if ( pvki < 1 || pvki > 6 ){
// 			return false ;	
// 		}
// 		return true ;
// 	}		
// 	
// }
// 
// Path: cryptocard/src/main/java/com/indarsoft/cryptocard/types/DesKeyType.java
// public enum DesKeyType {
// 
// 	SIMPLE(0), DOUBLE(1), TRIPLE(2) ;
//     @SuppressWarnings("unused")
// 	private int value;
// 
//     private DesKeyType (int value) {
//             this.value = value;
//     }	
// }


// Path: cryptocard/src/main/java/com/indarsoft/cryptocard/customerverify/Ibm3624Offset.java
import com.indarsoft.cryptocard.symmetrickey.Pvk;
import com.indarsoft.cryptocard.types.DesKeyType;
import com.indarsoft.utl.Ascii;
import com.indarsoft.utl.Binary;
import com.indarsoft.utl.Des;

package com.indarsoft.cryptocard.customerverify;

/**
 * Performs IBM3624 offset calculations.
 * 
 * @author fjavier.porras@gmail.com
 *
 */
public class Ibm3624Offset  {

	private static final int  BLK16  = 	16  ; //  (16 * 8 = 128 bits )
	private static final int  BLK08  = 	8   ; //  (8  * 8 = 64 bits )

	private Pvk pvk ;
