LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > General
User Name
Password
General This forum is for non-technical general discussion which can include both Linux and non-Linux topics. Have fun!

Notices


Reply
  Search this Thread
Old 09-11-2009, 05:54 PM   #16
jiml8
Senior Member
 
Registered: Sep 2003
Posts: 3,171

Rep: Reputation: 116Reputation: 116

Quote:
Originally Posted by GrapefruiTgirl View Post
I'd enjoy seeing a sed/awk/gawk something-or-other that could turn the original encoded message, into the decoded version.. Anyone?

Sasha

PS - I don't think it'd be TOOOO complicated, but I myself am rather "awkward" wrt awk.

Dhfess!
Might actually be easiest in C. that +1,0 stuff lends itself to working directly with the ASCII codes.

Last edited by jiml8; 09-11-2009 at 05:57 PM.
 
Old 09-11-2009, 05:55 PM   #17
GrapefruiTgirl
LQ Guru
 
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Rep: Reputation: 555Reputation: 555Reputation: 555Reputation: 555Reputation: 555Reputation: 555
Quote:
Originally Posted by XavierP View Post
I did? I googled the code and got 2 results: this page and the Facebook page. I'm rubbish at these things, so good luck to all job applicants.
Yeah, I missed that -- what exactly, did XavierP say?
 
Old 09-11-2009, 05:56 PM   #18
GrapefruiTgirl
LQ Guru
 
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Rep: Reputation: 555Reputation: 555Reputation: 555Reputation: 555Reputation: 555Reputation: 555
Quote:
Originally Posted by GrapefruiTgirl View Post
I'd enjoy seeing a sed/awk/gawk something-or-other that could turn the original encoded message, into the decoded version.. Anyone?

Sasha

PS - I don't think it'd be TOOOO complicated, but I myself am rather "awkward" wrt awk.

Dhfess!
Come on I KNOW someone's working on that behind the scenes lol -- as speculated the Far-Side farmer carrying the axe through the chcken farm where one chicken has a really long neck: "Whooooo's it gonna be?"

Last edited by GrapefruiTgirl; 09-11-2009 at 05:58 PM.
 
Old 09-11-2009, 06:34 PM   #19
JulianTosh
Member
 
Registered: Sep 2007
Location: Las Vegas, NV
Distribution: Fedora / CentOS
Posts: 674
Blog Entries: 3

Rep: Reputation: 90
Quote:
Originally Posted by GrapefruiTgirl View Post
Congratulations,

You passed our idiot filter. What are your 3 favorite books? Please include at least one software engineering book- the others can be whatever- ie., physics, math, etc..

I must admit, at first I thought it was talking about some restaurant, looking for a cook, to prepare items from a small menu including eggs and alcoholic drinks
GrapefruiTgirl, you're evil! 8^P
 
Old 09-11-2009, 06:46 PM   #20
GrapefruiTgirl
LQ Guru
 
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Rep: Reputation: 555Reputation: 555Reputation: 555Reputation: 555Reputation: 555Reputation: 555
Quote:
Originally Posted by Admiral Beotch View Post
GrapefruiTgirl, you're evil! 8^P
Oh ? Moi?? How so?

Sasha
 
Old 09-11-2009, 06:58 PM   #21
jiml8
Senior Member
 
Registered: Sep 2003
Posts: 3,171

Rep: Reputation: 116Reputation: 116
Code:
#include <stdio.h>
#include <string.h>
int main()
{
	char data[] = "Doogsauumauipnt >)! Zov qatsfd!ovr!ieipt!fjlues >) Wiau brf zovr!tirfe!fbvprjtf uedhoidam copkt? Pmebsf jndlvdf bt!lfatt!ooe!spfuwbrf fnhioefrjnh copk-uhf ptiess!cbn!bf xhbtfvfr- j.f.- qhzsjct,!mbti,!euc/";
	char *lineptr,*linestart,linedecoder;
	int linelen;
	linestart=data;
	linelen = strlen(data);
	linedecoder = -1;
	for(lineptr = linestart;lineptr <= linestart + linelen;lineptr++)
	{
		if(*lineptr == 0x33 ) //if an exclamation point invert the logic
		{
			linedecoder = (linedecoder == -1)?0:-1;
			lineptr++;
			printf(" ");
		}
		if(*lineptr == 0x2d ) // if a dash print it and move on without changing the logic
		{
			printf("%c",*lineptr);
			lineptr++;
		}
		if(*lineptr == 0x20) //if a space print it alone
		{
			printf(" ");
		}
		else // if not a space use the linedecoder value
		{
			printf("%c",*lineptr+linedecoder);
		}
		linedecoder = (linedecoder == -1)?0:-1;
	}
	printf("\n");
	return 0x0;
}
OK. Here you go. This decodes it correctly with one exception.

It would seem that the "encryption" is not consistent - as is shown by how the i.e. is handled by my translation. The rules I deploy work fine except for the string "- j.f- ". I've fiddled with it but don't see a consistent way to make it work and decided that making a special rule for it was not appropriate.

I put the string in as data rather than fiddle with the spaces in it to bring it in on the command line.

What a way to waste an hour, mostly fiddling with that i.e. string.

Last edited by jiml8; 09-11-2009 at 07:11 PM. Reason: slight code improvement
 
Old 09-11-2009, 07:05 PM   #22
GrapefruiTgirl
LQ Guru
 
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Rep: Reputation: 555Reputation: 555Reputation: 555Reputation: 555Reputation: 555Reputation: 555
Quote:
Originally Posted by jiml8 View Post
Code:
#include <stdio.h>
#include <string.h>
void main()
{
	char data[] = "Doogsauumauipnt >)! Zov qatsfd!ovr!ieipt!fjlues >) Wiau brf zovr!tirfe!fbvprjtf uedhoidam copkt? Pmebsf jndlvdf bt!lfatt!ooe!spfuwbrf fnhioefrjnh copk-uhf ptiess!cbn!bf xhbtfvfr- j.f.- qhzsjct,!mbti,!euc/";
	char *lineptr,*linestart,linedecoder;
	int linelen;
	linestart=data;
	linelen = strlen(data);
	linedecoder = -1;
	for(lineptr = linestart;lineptr <= linestart + linelen;lineptr++)
	{
		if(*lineptr == 0x33 ) //if an exclamation point invert the logic
		{
			linedecoder = (linedecoder == -1)?0:-1;
			lineptr++;
			printf(" ");
		}
		if(*lineptr == 0x2d) // if a dash print it and move on without changing the logic
		{
			printf("%c",*lineptr);
			lineptr++;
		}
		printf("%c",*lineptr+linedecoder);
		linedecoder = (linedecoder == -1)?0:-1;
	}
	printf("\n");
	return 0;
}
OK. Here you go. This decodes it correctly with one exception.

It would seem that the "encryption" is not consistent - as is shown by how the i.e. is handled by my translation. The rules I deploy work fine except for the string "- j.f- ". I've fiddled with it but don't see a consistent way to make it work and decided that making a special rule for it was not appropriate.

I put the string in as data rather than fiddle with the spaces in it to bring it in on the command line.

What a way to waste an hour, mostly fiddling with that i.e. string.
Holy crow Jim, nice work

When I decoded this initially, I only did it by eye; no computer involved; so I didn't really look closely at whether the algo will/would work consistently on a one-char-after-the-next basis.

If you include spaces, dashes, and periods, as characters just like letters, then the algo works consistently through that section of the encrypted data. However, a typo on behalf of the original author (such as) like an extra or missing space, would throw off the algo.

but the "j.f." itself translates cleanly.

Regardless, I say again, very nice work!

Sasha

PS - I wish I knew C even half as well as you evidently do

Last edited by GrapefruiTgirl; 09-11-2009 at 07:07 PM.
 
Old 09-11-2009, 08:47 PM   #23
floppywhopper
Member
 
Registered: Aug 2004
Location: Western Australia
Distribution: Mageia , Centos
Posts: 643
Blog Entries: 2

Rep: Reputation: 136Reputation: 136
Doogsauumauipnt >)! Zov qatsfd!ovr!ieipt!fjlues >)

In the early days of Microsoft

Wiau brf zovr!tirfe!fbvprjtf uedhoidam

I wanted a OS like linux, which is really cool, but

copkt? Pmebsf jndlvdf bt!

we went with windows !,

lfatt!ooe!spfuwbrf fnhioefrjnh copk-

boy ! do I feel like a stupid cock !

uhf ptiess!cbn!bf xhbtfvfr- j.f.

what a dumb mistake

- qhzsjct,!mbti,!euc/

Bill Gates
 
Old 09-11-2009, 11:24 PM   #24
estabroo
Senior Member
 
Registered: Jun 2008
Distribution: debian, ubuntu, sidux
Posts: 1,126
Blog Entries: 2

Rep: Reputation: 124Reputation: 124
You shouldn't need to do inversion anywhere. I think the problem at the end is actually caused by the original poster dropping a space after the copk- (which you see in the post containing the entire text.

Code:
#!/usr/bin/perl

$var = "Doogsauumauipnt >)! Zov qatsfd!ovr!ieipt!fjlues >) Wiau brf zovr!tirfe!fbvprjtf uedhoidam copkt? Pmebsf jndlvdf bt!lfatt!ooe!spfuwbrf fnhioefrjnh copk- uhf ptiess!cbn!bf xhbtfvfr- j.f.- qhzsjct,!mbti,!euc/";
@lets = ($var =~ m/(.)/g);

for ($i = 0; $i <= $#lets; $i += 2) {
        $a = unpack('c', $lets[$i]);
        $a--;
        $lets[$i] = pack('c', $a);
}

$ans = join('', @lets);
print "$ans\n";
 
Old 09-12-2009, 12:09 AM   #25
GrapefruiTgirl
LQ Guru
 
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Rep: Reputation: 555Reputation: 555Reputation: 555Reputation: 555Reputation: 555Reputation: 555
Quote:
Originally Posted by estabroo View Post
You shouldn't need to do inversion anywhere. I think the problem at the end is actually caused by the original poster dropping a space after the copk- (which you see in the post containing the entire text.

Code:
#!/usr/bin/perl

$var = "Doogsauumauipnt >)! Zov qatsfd!ovr!ieipt!fjlues >) Wiau brf zovr!tirfe!fbvprjtf uedhoidam copkt? Pmebsf jndlvdf bt!lfatt!ooe!spfuwbrf fnhioefrjnh copk- uhf ptiess!cbn!bf xhbtfvfr- j.f.- qhzsjct,!mbti,!euc/";
@lets = ($var =~ m/(.)/g);

for ($i = 0; $i <= $#lets; $i += 2) {
        $a = unpack('c', $lets[$i]);
        $a--;
        $lets[$i] = pack('c', $a);
}

$ans = join('', @lets);
print "$ans\n";
Excellent!
Sasha
 
Old 09-12-2009, 12:24 AM   #26
evil_empire
Member
 
Registered: Mar 2005
Distribution: Fedora Core 3
Posts: 176

Original Poster
Rep: Reputation: 31
Awesooooooooooooooome, u guys ROCK!!!!!!
 
Old 09-12-2009, 01:45 AM   #27
jiml8
Senior Member
 
Registered: Sep 2003
Posts: 3,171

Rep: Reputation: 116Reputation: 116
Quote:
Originally Posted by estabroo View Post
You shouldn't need to do inversion anywhere. I think the problem at the end is actually caused by the original poster dropping a space after the copk- (which you see in the post containing the entire text.
Yeah, I think you are right. Assuming that data error and changing it makes things a lot simpler. The i.e. is now handled properly. There is one other rule though; you don't subtract from a blank (0x20) because if you do you wind up changing it to a 0x19 which doesn' print.

With that assumed data error, my C program becomes a lot shorter: (I also changed the print from the character by character that I was doing to changing the string in place then printing at the end, like estabroo's perl example, so we have a direct perl/C comparison.

Code:
#include <stdio.h>
#include <string.h>
int main()
{
	char data[] = "Doogsauumauipnt >)! Zov qatsfd!ovr!ieipt!fjlues >) Wiau brf zovr!tirfe!fbvprjtf uedhoidam copkt? Pmebsf jndlvdf bt!lfatt!ooe!spfuwbrf fnhioefrjnh copk- uhf ptiess!cbn!bf xhbtfvfr- j.f.- qhzsjct,!mbti,!euc/";
	char *lineptr,*linestart,linedecoder;
	int linelen;
	linestart=data;
	linelen = strlen(data);
	linedecoder = -1;
	for(lineptr = linestart;lineptr <= linestart + linelen;lineptr++)
	{
		if(*lineptr != 0x20) *lineptr = *lineptr + linedecoder;
		linedecoder = (linedecoder == -1)?0:-1;
	}
	printf("%s\n",data);
	return 0x0;
}
Oh, also...

My original code had a rather embarrassing error in it. the ascii for exclamation point is 0x21, or decimal 33. What I was testing for when looking for 0x33 was the character 3. *Sigh*. So, serendipitiously my code worked because it was NOT flipping logic at any point...because there was no 3 in the text.

Last edited by jiml8; 09-12-2009 at 02:22 AM.
 
Old 09-12-2009, 01:54 AM   #28
jiml8
Senior Member
 
Registered: Sep 2003
Posts: 3,171

Rep: Reputation: 116Reputation: 116
Actually, with the recognition that we subtract one from the ascii of every other character, unless it is a space, I can remove the decision logic about what value to subtract and instead of testing every char, I just test every other char, just as estabroo does in his perl. I also changed main to type void so I don't need to return anything. This simplifies the code a bit more:
Code:
#include <stdio.h>
#include <string.h>
void main()
{
	char data[] = "Doogsauumauipnt >)! Zov qatsfd!ovr!ieipt!fjlues >) Wiau brf zovr!tirfe!fbvprjtf uedhoidam copkt? Pmebsf jndlvdf bt!lfatt!ooe!spfuwbrf fnhioefrjnh copk- uhf ptiess!cbn!bf xhbtfvfr- j.f.- qhzsjct,!mbti,!euc/";
	char *lineptr,*linestart;
	int linelen;
	linestart=data;
	linelen = strlen(data);
	for(lineptr = linestart;lineptr <= linestart + linelen;lineptr+=2)
	{
		if(*lineptr != 0x20) --*lineptr;
	}
	printf("%s\n",data);
}
 
Old 09-12-2009, 02:25 AM   #29
jiml8
Senior Member
 
Registered: Sep 2003
Posts: 3,171

Rep: Reputation: 116Reputation: 116
Quote:
When I decoded this initially, I only did it by eye; no computer involved; so I didn't really look closely at whether the algo will/would work consistently on a one-char-after-the-next basis.
I also did it by eye, once I saw what to do. But that engages the brain's pattern matching mechanisms and you automatically throw out things that don't work. Doing it by computer is harder because computers are completely literal.
 
Old 09-12-2009, 03:15 AM   #30
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
Quote:
Originally Posted by XavierP View Post
I did?
Quote:
Originally Posted by GrapefruiTgirl View Post
Yeah, I missed that -- what exactly, did XavierP say?
Ehm... It was an answer to the OP about the post count. XavierP said this:
Quote:
Oh, and no one's post count is increased by acting smart in this thread. General does not increase one's post count
and I repeated to remark:
Quote:
XavierP said that. Nobody increases his/her post count here.
I should have used a colon instead of a full stop to make it more clear. Sorry.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
A little instability in my Slackware, Need to decipher these errors BobNutfield Slackware 13 08-20-2008 10:02 AM
Can Someone help me to decipher this error? randell6564 Ubuntu 2 10-15-2006 04:20 PM
How to decipher this C declaration? CM019 Programming 6 05-28-2006 06:01 PM
Can anyone decipher my K3b error message? Trinity22 Linux - Software 3 04-21-2004 09:01 PM
Try to decipher this :) Whitehat General 42 06-29-2003 06:42 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > General

All times are GMT -5. The time now is 07:49 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration