⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cipher.java

📁 用JAVA编写的小的JAVA程序,是有关密码转换的.有2种算法.
💻 JAVA
字号:
/*
 * Created on 12.01.2005
 */

/**
 * @author Sebastian Frischbier
 */
public abstract class Cipher {

	private int intKey;
	private String sKey;

	/**
	 * Cipher alphabet - array of allowed characters
	 */
	final protected char[] ALPHABET = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p',
			'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'};
	
	abstract public String encrypt(String cleartext);
	
	abstract public String decrypt(String ciphertext);
	
	/*
	 * General getter and setter
	 */
	
	/**
	 * Set key for Caesar
	 * @param nkey
	 */
	public void setIntKey(int nkey)
	{
	  this.intKey = nkey;	
	}
	
	/**
	 * Set key for Vignere
	 * @param nkey
	 */
	public void setSKey(String skey)
	{
	  this.sKey = skey;	
	}
	
	
	/**
	 * Get key for Caesar
	 * @param nkey
	 */
	protected int getIntKey()
	{
		return this.intKey;
	}
	
	/**
	 * Get key for Vignere
	 * @param nkey
	 */
	protected String getSKey()
	{
		return this.sKey;
	}
	
	
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -