GeekInterview | Geeks Forum | Online Quiz | Learning Center | Privacy | Terms and Conditions | Contact
GeekInterview Code Base
Code Snippets Login Register

Encryt and Decrypt Text messages

One of the oldest and simplest encrypting technique is the "Caesar cipher". This involves shifting each of the letters in a message by a set number of places along the alphabet (cycling back the beginning of the alphabet if necessary). For example, if we wanted a shift of 5 places then A becomes F, B becomes G, … , Y becomes D and Z becomes E. So, the word JAMES becomes OERJX. The key to decrypt this code is 5 (representing the shift).

Here are two function one to encrypt and other to decrypt any given code by using "Caesar cipher" algorithm.
06 November, 2006
jamesravid
0
N/A
Encrypt function accepts two parameters the first one is a plain text the one which you want to encrypt and the second parameter is the shift variable n (you wants to shift alphabets to 5 places then values of n is 5). you can use this function in any sql query or a pl/sql code. Here is one simple example, select encrypt ('how are you?',5) from dual; --The above query should return mtb fwj dtz? Similarly, decrypt function accepts two parameters the first one is a encrypted text the one which you want to decrypt and the second parameter is the key value (for the above example the key values is 5). To decrypt the above code you can use the following query, select decrypt('mtb fwj dtz?',5) from dual; the query returns how are you?

 

Comments [ Leave Comment ]

No comments posted yet. Be the first one to comment.

 

Tips [ Leave Tip ]

No tips added yet. Be the first one to share tip.

 

Reviews [ Leave Review ]

No reviews added yet. Be the first one to review.

 

Tags

StreamConnection

 

Related Items

Find Character/Number Functions
Birth Number from Date - Numerology
Sending Mail using Gmail
Frame Window Creation
Create shortcuts on Desktop and Start Menu

 

Related Categories

Oracle » Database » PL/SQL
Copyright @GeekInterview.com