×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

caesar cipher encryption

caesar cipher encryption

caesar cipher encryption

(OP)
Can anyone help me out with this. I'v to make a Cipher encrypyion in prolog.

Typical input would be AAABBBCCC output would be CCCDDDEEE

it's a 3 letter jump encryption.

Any help is much appreciated.

RE: caesar cipher encryption

In Prolog, a string is a list of characters codes.
So, if you use SWI Prolog, you can use maplist to add 3 to the codes of the list "AAABBBCCC"

RE: caesar cipher encryption

(OP)
So, lets say a list
L("AAABBBCCC")
L2("")

I would do for example
encode(Char, L, L2) :- maplist(caesar(Char, L1, L2)

cipher(_, 26, 26) :- !.

would I be right doing this??

RE: caesar cipher encryption

Here is the code :

CODE --> Prolog

caesar(L1, L2) :-
	maplist(cipher, L1, LT),
	string_to_list(L2,LT).


cipher(X,Y) :-
	Y is X+3. 
and what you get

CODE --> Prolog

?- caesar("AAABBBCCC", L2) .
L2 = "DDDEEEFFF". 

RE: caesar cipher encryption

(OP)
Cheers man. Is that the whole program? I thought it would be a bit more complicated than that. This assignment is worth 25% of my total grand for the module.

RE: caesar cipher encryption

You just have to check what happens for XYZ !

RE: caesar cipher encryption

(OP)
Cheers,

Much appreciated

RE: caesar cipher encryption

Can anyone help me!!
If I wanted this to work with just the alphabet and no symbols or numbers how do I go about doing this and also is there anyway to use the space tab without getting a symbol in the encrypted part ? Thanks!!

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login


Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close