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

📄 rotdecoder.java

📁 java编写的数据库连接池的源代码。包含有连接池的源码。
💻 JAVA
字号:
/*
	DBPool - JDBC Connection Pool Manager
	Copyright (c) Giles Winstanley
*/
package snaq.db;

/**
 * Decodes passwords using the simple Rot13 algorithm.
 * This algorithm is very insecure, but is included as an example.
 * @author Giles Winstanley
 */
public class RotDecoder implements PasswordDecoder
{
	private static final int offset = 13;
	
	public char[] decode(String encoded)
	{
		return rot(encoded);
	}
	
	private char[] rot(String encoded)
	{
		StringBuffer sb = new StringBuffer(encoded);
		for (int a = 0; a < sb.length(); a++)
		{
			char c = sb.charAt(a);
			if (c >= 'A'  &&  c <= 'Z'  ||  c >= 'a'  &&  c <= 'z')
			{
				char base = Character.isUpperCase(c) ? 'A' : 'a';
				int i = c - base;
				c = (char)(base + (i + offset) % 26);
				sb.setCharAt(a, c);
			}
		}
		char[] out = new char[sb.length()];
		sb.getChars(0, out.length, out, 0);
		return out;
	}
	
/*	public static void main(String[] args) throws Exception
	{
		RotDecoder x = new RotDecoder();
		System.out.println(x.rot(args[0]));
	}*/
}

⌨️ 快捷键说明

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