Author Topic: [Java] Hex Encoding Plugin (JavaOp)  (Read 5248 times)

0 Members and 1 Guest are viewing this topic.

Offline Joe

  • B&
  • Moderator
  • Hero Member
  • *****
  • Posts: 10319
  • In Soviet Russia, text read you!
    • View Profile
    • Github
[Java] Hex Encoding Plugin (JavaOp)
« on: September 03, 2005, 09:50:02 pm »
   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.
I'd personally do as Joe suggests

You might be right about that, Joe.


Offline Newby

  • Moderator
  • Hero Member
  • *****
  • Posts: 10877
  • Thrash!
    • View Profile
Re: [Java] Hex Encoding Plugin (JavaOp)
« Reply #1 on: September 03, 2005, 09:51:26 pm »
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

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. 

Offline MyndFyre

  • Boticulator Extraordinaire
  • x86
  • Hero Member
  • *****
  • Posts: 4540
  • The wait is over.
    • View Profile
    • JinxBot :: the evolution in boticulation
Re: [Java] Hex Encoding Plugin (JavaOp)
« Reply #2 on: September 03, 2005, 09:55:40 pm »
Code: [Select]
String pref = "0x";
return pref.concat(Integer.toString(Integer.parseInt(txt[1]), 16);
I have a programming folder, and I have nothing of value there

Running with Code has a new home!

Our species really annoys me.

Offline Joe

  • B&
  • Moderator
  • Hero Member
  • *****
  • Posts: 10319
  • In Soviet Russia, text read you!
    • View Profile
    • Github
Re: [Java] Hex Encoding Plugin (JavaOp)
« Reply #3 on: September 03, 2005, 09:58:43 pm »
*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;
   }
I'd personally do as Joe suggests

You might be right about that, Joe.


Offline Ergot

  • 吴立峰 ^_^ !
  • x86
  • Hero Member
  • *****
  • Posts: 3724
  • I steal bandwidth. p_o
    • View Profile
Re: [Java] Hex Encoding Plugin (JavaOp)
« Reply #4 on: September 03, 2005, 10:18:25 pm »
Wasn't there that whole "encode" command on JavaOp1 ?
Who gives a damn? I fuck sheep all the time.
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

Offline Joe

  • B&
  • Moderator
  • Hero Member
  • *****
  • Posts: 10319
  • In Soviet Russia, text read you!
    • View Profile
    • Github
Re: [Java] Hex Encoding Plugin (JavaOp)
« Reply #5 on: September 03, 2005, 10:23:26 pm »
I think that was iago's Gaim plugin, but it was in C++. I may just have to look though.
I'd personally do as Joe suggests

You might be right about that, Joe.


Offline Joe

  • B&
  • Moderator
  • Hero Member
  • *****
  • Posts: 10319
  • In Soviet Russia, text read you!
    • View Profile
    • Github
I'd personally do as Joe suggests

You might be right about that, Joe.


Offline iago

  • Leader
  • Administrator
  • Hero Member
  • *****
  • Posts: 17914
  • Fnord.
    • View Profile
    • SkullSecurity
Re: [Java] Hex Encoding Plugin (JavaOp)
« Reply #7 on: September 06, 2005, 03:24:16 pm »
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". 

Offline Joe

  • B&
  • Moderator
  • Hero Member
  • *****
  • Posts: 10319
  • In Soviet Russia, text read you!
    • View Profile
    • Github
Re: [Java] Hex Encoding Plugin (JavaOp)
« Reply #8 on: September 06, 2005, 11:43:05 pm »
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!
I'd personally do as Joe suggests

You might be right about that, Joe.