Post: [C] Text Cypher
02-08-2011, 11:39 PM #1
jackrtk
haters gonna' hate
(adsbygoogle = window.adsbygoogle || []).push({}); Hey, this is just something I coded a while back and wanted to show you guys.

Here is the code:
    /*
* Text cypher by jackrtk
* usage: something.exe your text goes here!
* example output: 979b99a15ba9a0a75f97a7979aa39e9e67a5b1
*
* also, heres a challenge: decypher the example output Winky Winky
*/

#include <stdio.h>

void main(int argc, char *argv[])
{
int i,
k,
j;
printf("Encrypted Text: ");

for(k = 1; k != argc; k++)
{
for(i = 0; argv[k][i] != 0; i++)
{
j = ((argv[k][i]+i)+43); // algorithm: ((position in array + hex(chr))+43)
printf("%x",j);
}
}
}

BreakDown

Let's focus on 'cypher' code:

argv[k] = the 'k'th argument passed to the program, for example, if you executed:

cypher.exe hello im jack
argv[1] = hello
argv[2] = im
You get the picture...

So, argv[k]; we know that k is the argument number, so 'i' is the char of that argument, example:

cypher.exe hello im jackr
argv[1][3] = "l"
argv[3][1] = "j"

Once we have this character, we apply our algorithm to it. My algorithm is

hex(((argv[k]+i)+43));

When we execute: cypher.exe lol hi

the program executes (to find "l"):

hex(((argv[1][1]+i)+43))
= hex(108+1+43)
= hex(152)
= 98

This procedure is repeated until no characters are left.

kbai; jackrtk.
Last edited by jackrtk ; 02-08-2011 at 11:40 PM. Reason: Typo!
02-09-2011, 07:32 AM #2
A tip: Dont use explicit Variable names, it makes it almost impossible for others to help.
02-09-2011, 08:17 AM #3
jackrtk
haters gonna' hate
Thanks for the advice Happy

Copyright © 2024, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo