News:

Who uses forums anymore?

Main Menu

[Java] Hex Encoding Plugin (JavaOp)

Started by Joe, September 03, 2005, 09:50:02 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Joe

   public String queuingText(String text, Object data) {
      String txt[] = text.split(" ");
      String ret;
        if(txt[0] == "/hex") {
           for(int i = 1; i > text.length() - 5; i++) {
              
           }
        }
      return ret;
   }


Basically, I've got the easy stuff down. I see if the left end of the string says "/hex", and if it does, I loop through the rest. Whats left to do is..

1) Cast the ASCII value of the byte at text.substr(i, 1) to a numeric data type (int?).
2) Cast the number to hex
3) Cast the hex to a string
4) Pad the string with a 0 at the left, asuing its needed.
5) Append the string to "ret"

What I need help with..
1, 2

I asume that the hex would be a string, anyhow. Padding shouldn't be too hard, and appending a string is childs play.
Quote from: Camel on June 09, 2009, 04:12:23 PMI'd personally do as Joe suggests

Quote from: AntiVirus on October 19, 2010, 02:36:52 PM
You might be right about that, Joe.


Newby

Shrug. I don't know Java. Why did you link me to this? :p
- Newby
http://www.x86labs.org

Quote[17:32:45] * xar sets mode: -oooooooooo algorithm ban chris cipher newby stdio TehUser tnarongi|away vursed warz
[17:32:54] * xar sets mode: +o newby
[17:32:58] <xar> new rule
[17:33:02] <xar> me and newby rule all

Quote from: Rule on June 30, 2008, 01:13:20 PM
Quote from: CrAz3D on June 30, 2008, 10:38:22 AM
I'd bet that you're currently bloated like a water ballon on a hot summer's day.

That analogy doesn't even make sense.  Why would a water balloon be especially bloated on a hot summer's day? For your sake, I hope there wasn't too much logic testing on your LSAT. 

MyndFyre


String pref = "0x";
return pref.concat(Integer.toString(Integer.parseInt(txt[1]), 16);
Quote from: Joe on January 23, 2011, 11:47:54 PM
I have a programming folder, and I have nothing of value there

Running with Code has a new home!

Quote from: Rule on May 26, 2009, 02:02:12 PMOur species really annoys me.

Joe

*crosses fingers*

   public String queuingText(String text, Object data) {
      String txt[] = text.split(" ");
      String ret;
        if(txt[0] == "/hex") {
           for(int i = 1; i > text.length() - 5; i++) {
              ret = ret.concat(Integer.toString(Integer.parseInt(text.substring(i, 1)), 16));
           }
        }
      return ret;
   }
Quote from: Camel on June 09, 2009, 04:12:23 PMI'd personally do as Joe suggests

Quote from: AntiVirus on October 19, 2010, 02:36:52 PM
You might be right about that, Joe.


Ergot

Wasn't there that whole "encode" command on JavaOp1 ?
Quote from: Newby on February 26, 2006, 12:16:58 AM
Who gives a damn? I fuck sheep all the time.
Quote from: rabbit on December 11, 2005, 01:05:35 PM
And yes, male both ends.  There are a couple lesbians that need a two-ended dildo...My router just refuses to wear a strap-on.
(05:55:03) JoE ThE oDD: omfg good job i got a boner thinkin bout them chinese bitches
(17:54:15) Sidoh: I love cosmetology

Joe

I think that was iago's Gaim plugin, but it was in C++. I may just have to look though.
Quote from: Camel on June 09, 2009, 04:12:23 PMI'd personally do as Joe suggests

Quote from: AntiVirus on October 19, 2010, 02:36:52 PM
You might be right about that, Joe.


Joe

Quote from: Camel on June 09, 2009, 04:12:23 PMI'd personally do as Joe suggests

Quote from: AntiVirus on October 19, 2010, 02:36:52 PM
You might be right about that, Joe.


iago

You should make it more universal and use a Command plugin, so it'll catch "/hex" and "?hex".  Make "hex" a command requiring flags "T". 

Joe

iago, arround 4-6 our time tomorrow, mind contacting me? I wanna show you what I have. I had it load alright, but it didn't catch the /hex. Oops, callbacks weren't registered. Boom! Bye plugin!
Quote from: Camel on June 09, 2009, 04:12:23 PMI'd personally do as Joe suggests

Quote from: AntiVirus on October 19, 2010, 02:36:52 PM
You might be right about that, Joe.