Encryt and Decrypt Text messages
| Description: |
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. |
| Date added: |
06 November, 2006 |
| Submitted By: |
jamesravid |
| Rating: |
0 |
| Download: |
N/A |
| Instructions: |
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? |
| Source Code: |
|
|