Raised This Month: $ Target: $400
 0% 

Useful C++ program


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Jheshka
Senior Member
Join Date: Dec 2005
Old 04-28-2009 , 13:34   Useful C++ program
Reply With Quote #1

In my programming class, I'm starting my culminating. It's supposed to be a program with a purpose, instead of spewing out random integers, or other useless functions.

Does anyone have anything they think would be useful or fun?


I'm fresh out of ideas...
__________________
James
Jheshka is offline
Styles
Veteran Member
Join Date: Jul 2004
Location: California
Old 04-28-2009 , 13:36   Re: Useful C++ program
Reply With Quote #2

Built an app that connects to a P2P network as POC work... use like the Gnutella network..
Styles is offline
Send a message via AIM to Styles
Jheshka
Senior Member
Join Date: Dec 2005
Old 04-28-2009 , 13:37   Re: Useful C++ program
Reply With Quote #3

I'd have to be able to do it from school to show my teacher... P2P networks use ports that are completely blocked at my school. Any other ideas?
__________________
James
Jheshka is offline
Styles
Veteran Member
Join Date: Jul 2004
Location: California
Old 04-28-2009 , 13:41   Re: Useful C++ program
Reply With Quote #4

Yea, a simple file encryption app. Give it a file name .. it reads the file .. encrypts it then decrypts it if you want, like have options.. Make it use like RC4 Encryption (look it up)

Code:
char *EnDeCrypt(const char *pszText, int iTextLen, const char *pszKey)
{
    char *cipher;                       /* Output buffer                */
    int a, b, i=0, j=0, k;              /* Ambiguously named counters   */
    int ilen;                           /* Length of a string           */
    int sbox[256];                      /* Encryption array             */
    int key[256];                       /* Numeric key values           */

    ilen = strlen(pszKey);

    for (a=0; a < 256; a++)
    {
        key[a] = pszKey[a % ilen];
        sbox[a] = a;
    }

    for (a=0, b=0; a < 256; a++)
    {
        b = (b + sbox[a] + key[a]) % 256;
        swapints(sbox, a, b);
    }

    cipher = (char *)malloc(iTextLen);

    for (a=0; a < iTextLen; a++)
    {
        i = (i + 1) % 256;
        j = (j + sbox[i]) % 256;
        swapints(sbox, i, j);
        k = sbox[(sbox[i] + sbox[j]) % 256];
        cipher[a] = pszText[a] ^ k;
    }
    return cipher;
}


void swapints(int *array, int ndx1, int ndx2)
{
    int temp = array[ndx1];
    array[ndx1] = array[ndx2];
    array[ndx2] = temp;
}
// I didn't write this but it's useful
Styles is offline
Send a message via AIM to Styles
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 12:33.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode