Need to know about one function which can encrypt and decrypt the text

View: New views
3 Messages — Rating Filter:   Alert me  

Need to know about one function which can encrypt and decrypt the text

by Irfan Ahmed :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I need to know about any cryptographic algorithm in which we dont need to use separate functions to encrypt and decrypt the text using symmetric key.

Though We can also make a simple function by combinning encryption and decrytpion functions using any switch statement or if-else.But it is not required.

I need to know about any function in which if we pass simple text with key, it encrypts it or vice versa.

Re: Need to know about one function which can encrypt and decrypt the text

by GogleMan :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

An easy function is ROT-13 which means rotate by 13.  Replace each letter by the one 13 places beyond. After Z wrap around to A.  Thus A is replaced by N, B by O, C by P, ...  N by A, O by B, P by C etc.       Perform ROT-13 twice and you get back the original message.  No key is used. ROT-13 is used to obscure answers to puzzles.  But it provides zero security since many people can read it in a flash.

A very sophisticated system of the type you seek was the German Enigma.  That was broken by the British during WWII.  

Re: Need to know about one function which can encrypt and decrypt the text

by zwanderer :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

one time pad cipher. recently reaqd it in w. stallings  ;)
LightInTheBox - Buy quality products at wholesale price!