decryption : reversing

This is a discussion on decryption : reversing within the C++ Programming forums, part of the General Programming Boards category; yeah this is kind of based on C++ but i thought maybe the people ive helped before could help me ...

  1. #1
    Registered User
    Join Date
    Dec 2001
    Posts
    206

    decryption : reversing

    yeah this is kind of based on C++ but i thought maybe the people ive helped before could help me with this plz? thx.

    I am reversing an encryption from a site that uses java.
    this is the code:

    H!8(#i9\;S@HC-
    !668);$j&On,5[
    2$k]ZK^4 t*D<>z6I!BL9>M,U@3<A1"-S&1>Q,m")9"L)<&-UG0X,h$i+a
    5S:S;Rr%
    5_k#-\:Y.Q{/4[DKAJ-f=BCK?J7L.W
    UGH:7(/S"_,Ws(!ct%-b,f#+BFBR*c*b

    ------------------------------------------------------------------------------------


    and this is the (java) encryption :


    ------------------------------------------------------------------------------------

    String DeCrypto(String eText)
    {
    char ff = ' ';
    String dText = new String();
    char hold[] = new char[eText.length() / 2];
    for(int i = 0; i < eText.length() / 2; i++)
    {
    char c1 = eText.charAt(2 * i);
    char c2 = eText.charAt(2 * i + 1);
    char k;
    if(c1 > c2)
    k = (char)((c1 - c2) + ff);
    else
    k = (char)((c2 + c1) - ff);
    hold[i] = k;
    }
    dText = new String(hold);
    return dText;
    }

    ------------------------------------------------------------------------------------


    i know you can reverse this with C/C++/etc.... but im just plain stuck. coulkd someone please reverse this? thank you in advance
    Last edited by Denethor2000; 04-07-2002 at 02:30 PM.

  2. #2
    Registered User
    Join Date
    Dec 2001
    Posts
    206
    come on prelude, i know YOU can do this. by what ive heard you say and tell what you know, and the fact that you never come here to ASK questions, you are the best programmer here.

    You HAVE to be able to do this in like at the most 10 minutes rite?

  3. #3
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,796
    >come on prelude, i know YOU can do this
    Ack, busted

    >you are the best programmer here
    Definitely not, Salem is better for sure, and quite a few others.
    Code:
    #include <iostream>
    #include <fstream>
    #include <string>
    using namespace std;
    
    string DeCrypto(string eText) 
    { 
      char ff = ' ', c1, c2, k; 
      string dText; 
      char hold[BUFSIZ] = {0}; 
      for(int i = 0; i < eText.length() / 2; i++) { 
        c1 = eText[2 * i]; 
        c2 = eText[2 * i + 1]; 
        if(c1 > c2) 
          k = (char)((c1 - c2) + ff); 
        else 
          k = (char)((c2 + c1) - ff); 
        hold[i] = k; 
      } 
      dText = hold; 
      return dText; 
    }
    
    int main ( void )
    {
      fstream in("test.txt");
      string a, b;
      while ( in.good() ) {
        getline ( in, a );
        b = DeCrypto ( a );
        cout<< b <<"\n";
      }
      return 0;
    }
    You might want to verify the decrypted data, it looks odd. The algorithm is the same so it may be buggy.

    -Prelude
    My best code is written with the delete key.

  4. #4
    Registered User
    Join Date
    Dec 2001
    Posts
    206
    thanks.
    but omg look at this lol:

    C:\MSDEV\Projects\pqzm\main.cpp(1) : fatal error C1083: Cannot open include file: 'iostream': Permission denied

    C:\MSDEV\Projects\pqzm\main.cpp(2) : fatal error C1083: Cannot open include file: 'fstream': Permission denied

    C:\MSDEV\Projects\pqzm\main.cpp(3) : fatal error C1083: Cannot open include file: 'string': Permission denied


    WTF?
    Last edited by Denethor2000; 04-07-2002 at 03:00 PM.

  5. #5
    I am the worst best coder Quantrizi's Avatar
    Join Date
    Mar 2002
    Posts
    644
    This post above is the reason why Java sucks IMHO*although C++ and Java are closely related*

  6. #6
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,796
    >C:\MSDEV\Projects\pqzm\main.cpp(1) : fatal error C1083:
    >Cannot open include file: 'iostream': Permission denied
    This is an odd one. I don't remember ever seeing a permission denied error on a standard header before. I'll see if I can find something because the code runs fine for me and should work for you as well.

    >This post above is the reason why Java sucks IMHO
    That reason would be?

    -Prelude
    My best code is written with the delete key.

  7. #7
    Linguistic Engineer... doubleanti's Avatar
    Join Date
    Aug 2001
    Location
    CA
    Posts
    2,459
    hmm... just maybe you should check the access rights for yoru library... i'd figure it wouldn't matter since only read operations are performed, but you never know what the compiler might need or do... also, if you've found the code for this reversible process from a public place, chances are that you can find it's inverse as well... if you have trouble with Prelude's suggestion...
    hasafraggin shizigishin oppashigger...

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. reversing a string, again..
    By Disident in forum C Programming
    Replies: 5
    Last Post: 06-15-2009, 08:01 PM
  2. Reversing output in this function
    By rogster001 in forum C Programming
    Replies: 8
    Last Post: 02-07-2008, 05:36 AM
  3. Encryption and Decryption Program in C++ using a class
    By goron350 in forum C++ Programming
    Replies: 7
    Last Post: 06-05-2005, 09:29 PM
  4. reversing a singly linked list
    By galmca in forum C Programming
    Replies: 6
    Last Post: 02-07-2005, 09:25 AM
  5. decryption problems
    By waterst in forum C Programming
    Replies: 1
    Last Post: 10-27-2002, 06:01 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21