Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hi. I am a beginner on scripting.
I will write a shell script for string encryption/decryption. the script will take 3 parameters. First one will be a flag telling whether to do encryption or decryption. Second parameter will be an integer of unknown size (password). Third parameter will be the string to encrypt/decrypt. The output of the script will be just the encrypted/decrypted string. It should work as below:
#> 240702099_sh2b.sh –e 2967 “this is the string to encrypt” erh,sas1:?wqe!@ zxdcdo? ddsaa
#> 240702099_sh2b.sh –d 2967 “erh,sas1:?wqe!@ zxdcdo? ddsaa” this is the string to encryptI need to create an array like this:
letter_list=”abcdefghijklmnopqrstuvwyz!?,. ><+-:;”
For encryption, the idea is to take a letter from the input string, find its index in the letter_list (call it cind). then take the current digit of the password, add this value to the cind and exchange the current letter in the string with the character at index cind from the letter_list. If After the summation, cind becomes more than the size of the letter_list, the circle to the other end of the array. Then it will skip to the next letter in the string and next digit in the password. If it exceeds the boundaries of password, it will start from the beginning of it.
For encryption i need to use the circle manner also.Can anybody hepl me please? Sorry for the long message

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |