CyberArmy University | Open Source Institute | CyberArmy Intelligence & Security | CyberArmy Services & Projects

Java - ASCII2Bin - First Draft


[Replies] [Reply] [View by Thread] [Help]
[Back To SNEAK Development Forum]

Posted by Ker Socrat On 2005-02-17 20:09:14
In Reply to Desktop Version Posted by CinC snarkles On 2005-02-15 17:19:31

Ker
Ker Socrat


Ok, i managed to find how to change a character to its binary form with this code. The problem is , when i entered a normal character ( a or b or ^*&*( ;' ) its fine, it give the exact same result as the php SNEAK. but then i tryed with some ASCII like °╞╧◘↔¼èá4↕ÿ and that messed up because on the php SNEAK version, the characters are converted back to #6365 or whatever their value is before they are converted to binary. But with this code they get converted for their real binary value, which is not what we want since they can be 15 chars long (1100101011110). So anyone knows how to modify it to check if its a "special" char and if it is convert to the #5646 value?
	public static String string2Bin(String str){	
		
		String binaryString = new String();
		for(int i=0;i<str.length();i++){
			int decimal = str.charAt(i);
			String binary = Integer.toBinaryString(decimal);
			binaryString += " 0"+binary;
		}
		return binaryString;
	}
Kernel Socrat
X/O CAUniversity
CAUniversity.org Administrator
Cyberarmy Staff Member
CAUniversity.org




Replies:


Guest:
Subject:
Message:
Signature:
Optional Image Link:
http://

CyberArmy::Forum v0.6
Generated In 0.02296 seconds


About Us | Privacy Policy | Mission Statement | Help