• RSS
  • Twitter
  • FaceBook

Security Forums

Log in

FAQ | Usergroups | Profile | Register | RSS | Posting Guidelines | Recent Posts

Pascal help...

Users browsing this topic:0 Security Fans, 0 Stealth Security Fans
Registered Security Fans: None
Post new topic   Reply to topic   Printer-friendly version    Networking/Security Forums Index -> Programming and More

View previous topic :: View next topic  
Author Message
decypherohm
Just Arrived
Just Arrived


Joined: 16 Nov 2002
Posts: 1
Location: World - Europe - Portugal - Lisbon

Offline

PostPosted: Tue Dec 10, 2002 12:16 am    Post subject: Pascal help... Reply with quote

I want to write a program the if u enter a word it will output the word but a letter in advance...(e.g. ABC = BCD; HAL = IBM etc...) but i could only do that with a single char... like this :

program blah;

Var
coded : char;

Begin
Writeln('Enter char:');
readln(coded);
coded:= Chr(coded)+ 1;
writeln('Coded text:', coded);
end.

not sure if this was like i made but its something like it! plz help
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
haydies
Just Arrived
Just Arrived


Joined: 19 Apr 2002
Posts: 0
Location: Hades

Offline

PostPosted: Tue Dec 10, 2002 12:29 am    Post subject: Reply with quote

Pascal strings are an array of char, just loop through the string.

For i := 1 to Length(TheString) Do Begin
AnotherString := AnotherString + Chr(Ord(TheString[i]) + 1 ) ;
End {For} ;

Some thing like that, I haven't used a pascal compiler other then delphi in some time so Chr and Ord might be called some thing else. But the strings are the same.
Back to top
View user's profile Send private message Visit poster's website
Wombat
Trusted SF Member
Trusted SF Member


Joined: 24 Apr 2002
Posts: 0
Location: Canberra

Offline

PostPosted: Tue Dec 10, 2002 1:49 am    Post subject: Reply with quote

What happens with Z? Does it get converted to A? You need to think about things like this!
Back to top
View user's profile Send private message
haydies
Just Arrived
Just Arrived


Joined: 19 Apr 2002
Posts: 0
Location: Hades

Offline

PostPosted: Tue Dec 10, 2002 2:18 am    Post subject: Reply with quote

Nope, you have to deal with that.... easy enougth to check though.

Its jsut adding one to the asci code for the char. You can just check to see if the number is > Ord('Z') if it is, set it back to 'A' or what ever depending on what you want. But with out checking I'm fairly sure Z + 1 is printable.... can't remember off hand if Capitals are higher or lower ascii values then lower case.

My excuse is its gone midnight and I can't be arsed to run Delphi to check Smile
Back to top
View user's profile Send private message Visit poster's website
Wombat
Trusted SF Member
Trusted SF Member


Joined: 24 Apr 2002
Posts: 0
Location: Canberra

Offline

PostPosted: Tue Dec 10, 2002 3:32 am    Post subject: Reply with quote

One higher than Z is [ and one higher than z is {, but if anyone sees these in your string they'll know immediately what is happening. Is this for simple encryption? If so, think about what you'd like your prog to do with spaces (one higher than space is !) and punctuation (one higher than , is - and one higher than . is / etc) and numbers (you'll get the next number obviously, and one higher than 9 is :).
Back to top
View user's profile Send private message
haydies
Just Arrived
Just Arrived


Joined: 19 Apr 2002
Posts: 0
Location: Hades

Offline

PostPosted: Tue Dec 10, 2002 3:46 am    Post subject: Reply with quote

Not to mention that using that for encryption would last for about 5 seconds if some one wanted to crack it..... Its not really encryption at all at the end of the day.

My self, I like random number tables and some other funky code to make sure a char never gets encrypted to the same char twice. Makes it so much harder to decrypt... well, actualy, normaly thats for passwords so its more or less impossible to ever decrypt them Razz
Back to top
View user's profile Send private message Visit poster's website
Wombat
Trusted SF Member
Trusted SF Member


Joined: 24 Apr 2002
Posts: 0
Location: Canberra

Offline

PostPosted: Tue Dec 10, 2002 5:00 am    Post subject: Reply with quote

Sure it would be easy to crack. So deciding if it's appropriate depends on what it's being used for. As it's so simple, maybe a better word than "encryption" would be "obfuscation".

The best word ever is "moist", but that means something completely different.
Back to top
View user's profile Send private message
haydies
Just Arrived
Just Arrived


Joined: 19 Apr 2002
Posts: 0
Location: Hades

Offline

PostPosted: Tue Dec 10, 2002 5:06 am    Post subject: Reply with quote

Ye, I'd agree with that. Hardly worth it really....but I guess if you have to do it for some reason....

as its pascal and such a minor thing its probably a uni thing, sounds like the sort of app students get set. Pascal is a good teaching language as well. Even if its not OO for the most part (Dephi being only based on Pascal). I remember the days of the Amstrade CPC464 and my little pascal compiler..... oh my god, now I feel old.....

Any way, now I am going to bed before I get the bright idea of writeing some form of funky encryption thingy.... 3am, its time to sleep....
Back to top
View user's profile Send private message Visit poster's website
decypherohm
Just Arrived
Just Arrived


Joined: 16 Nov 2002
Posts: 1
Location: World - Europe - Portugal - Lisbon

Offline

PostPosted: Tue Dec 10, 2002 12:52 pm    Post subject: Reply with quote

When it gets Z+1 it will go to the next char in the ascii table...but this is just the beggining.... i complicate it alot... i have pascal language at schol but i am not very advanced...when that program ends.... it will encrypt the original word 10 times or more of a much more complicated encryption...Razz
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
ShaolinTiger
Forum Fanatic
Forum Fanatic


Joined: 18 Apr 2002
Posts: 16777215
Location: Kuala Lumpur, Malaysia

Offline

PostPosted: Tue Dec 10, 2002 12:56 pm    Post subject: Reply with quote

decypherohm wrote:
When it gets Z+1 it will go to the next char in the ascii table...


Yup, which is not A Very Happy

This is basically like ROT13 but it's not, it's ROT1 Smile

ROT13 is used commonly on Usenet just to stop lamers reading stuff and to post offensive/illegal things without breaking your TOS blatantly.

I encrypt all my messages here and on Usenet with ROT26, HARDCORE! Twisted Evil Shocked Twisted Evil
Back to top
View user's profile Send private message Visit poster's website
decypherohm
Just Arrived
Just Arrived


Joined: 16 Nov 2002
Posts: 1
Location: World - Europe - Portugal - Lisbon

Offline

PostPosted: Tue Dec 10, 2002 12:58 pm    Post subject: Reply with quote

nice... i didnt know that... but hey going to study the ROT13 encryption and make a program to encrypt/decrypt it!

Very nice... with witch program?!?!
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
b4rtm4n
Trusted SF Member
Trusted SF Member


Joined: 26 May 2002
Posts: 16777206
Location: Bi Mon Sci Fi Con

Offline

PostPosted: Wed Dec 11, 2002 1:01 am    Post subject: Reply with quote

mmm Re-inventing the Roman wheel.

2000 year old tech is still 2000 year old tech even if 5% of the worlds pop are smart enough to interpret it.
Back to top
View user's profile Send private message Send e-mail
Wombat
Trusted SF Member
Trusted SF Member


Joined: 24 Apr 2002
Posts: 0
Location: Canberra

Offline

PostPosted: Wed Dec 11, 2002 1:30 am    Post subject: Reply with quote

There's nothing wrong with reinventing the wheel as a learning excercise. Have fun, decypherohm!

(when I tried it, it came out triangular)
Back to top
View user's profile Send private message
haydies
Just Arrived
Just Arrived


Joined: 19 Apr 2002
Posts: 0
Location: Hades

Offline

PostPosted: Wed Dec 11, 2002 5:44 am    Post subject: Reply with quote

Hasn't every thing already been done? There is a thing called "Patterens" that are the building blocks of programmes. What makes a good programmer is expirance, i.e. how many things they know how to do. Once you get past a point there isn't a lot thats "new". Its just more complicated ways to use the same old little bits of code. Same as every thing else I guess, the more you know, the easier it gets. Every one has to start some where.....
Back to top
View user's profile Send private message Visit poster's website
decypherohm
Just Arrived
Just Arrived


Joined: 16 Nov 2002
Posts: 1
Location: World - Europe - Portugal - Lisbon

Offline

PostPosted: Wed Dec 11, 2002 9:22 am    Post subject: Reply with quote

Finished the programs... but it isnt the ROT13 encryption... i mean it rotates 13 times but when it get to Z it will no go to A it will go to the next char in ascii table! Razz Laughing
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
ShaolinTiger
Forum Fanatic
Forum Fanatic


Joined: 18 Apr 2002
Posts: 16777215
Location: Kuala Lumpur, Malaysia

Offline

PostPosted: Wed Dec 11, 2002 11:22 am    Post subject: Reply with quote

decypherohm wrote:
Finished the programs... but it isnt the ROT13 encryption... i mean it rotates 13 times but when it get to Z it will no go to A it will go to the next char in ascii table! Razz Laughing


Well fix it then Very Happy

Aint ROT13 if it skips outside the roman alpha characters.

That's your next challenge Razz
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   

Post new topic   Reply to topic   Printer-friendly version    Networking/Security Forums Index -> Programming and More All times are GMT + 2 Hours
Page 1 of 1


 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

Looking for more Windows Networking info?

Sign up to the WindowsNetworking.com Monthly Newsletter, written by Enterprise Security MVP Deb Shinder, containing news, the hottest tips, Networking links of the month and much more. Subscribe today and don't miss a thing!
View a sample newsletter.

Become a WindowsNetworking.com member!

Discuss your Windows Networking issues with thousands of other Windows Newtorking experts. Click here to join!

Community Area

Log in | Register

Readers' Choice

Which is your preferred data recovery solution?

Follow TechGenix on Twitter