Sponsored Content
Top Forums Shell Programming and Scripting Read user input, Encrypt the data and write to file Post 302714387 by saichand1985 on Friday 12th of October 2012 09:07:34 AM
Old 10-12-2012
Thanka for your responce MIRNI... i will check your code and get back to you...

---------- Post updated at 06:37 PM ---------- Previous update was at 03:34 PM ----------

Hi Mirni tahnks fo rthe code. in encryption part it is working fine. a small modification, it should not prompt user to enter the key. is there any other way to encrypt the content without giving key and write output to file.

why im asking is while dycrypting it should not ask me to provide key. im going to sdecrypt the credentials.txt.encrypt file with another script. also can you plz give me code for encrypt and decrypt seperately.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

read/writte/input data in file.

Hi, how can i do to show when i do with scrip list entris, or list specific entry, it show 2 lines when i specify the entry to search...¿? i paste the script: # Global variables film=/opt/etc/film/film.txt export film confirm() { echo -en "$@" read ans ans=`echo $ans | tr... (0 Replies)
Discussion started by: dorek
0 Replies

2. Programming

Read/Write a fairly large amount of data to a file as fast as possible

Hi, I'm trying to figure out the best solution to the following problem, and I'm not yet that much experienced like you. :-) Basically I have to read a fairly large file, composed of "messages" , in order to display all of them through an user interface (made with QT). The messages that... (3 Replies)
Discussion started by: emitrax
3 Replies

3. Shell Programming and Scripting

Read Write byte range/chunk of data from specific location in file

I am new to Unix so will really appreciate if someone can guide me on this. What I want to do is: Step1: Read binary file - pick first 2 bytes, convert from hex to decimal. Read the next 3 bytes as well. 2 bytes will specify the number of bytes 'n' that I want to read and write... (1 Reply)
Discussion started by: Kbenipel
1 Replies

4. Shell Programming and Scripting

get data from input file and write another file

Hi, i have doubt in read and write using bash shell script... i will give the input file path and output file path in command line ex : example.sh iputfile outpilepath Here i need to read the input data then write that data to output file.. please give some example : (6 Replies)
Discussion started by: karthinvk
6 Replies

5. Shell Programming and Scripting

Read the apecific data from one file and write into another file

Hi, I would like to read the specific data from file and write the data in the new file. My data input is something like this.. <EXROP:R=TJ0311T; ROUTE DATA R ROUTE PARAMETERS TJ0311T DETY=UPDR TTRANS=1 FNC=3 MA=628160955000 R=TJ0311D ... (3 Replies)
Discussion started by: bha148
3 Replies

6. Shell Programming and Scripting

Help to write a script or program to automatic execute and link input file data

Output file template format <input_file_name>a</input_file_name> <total_length_size>b</total_length_size> <log_10_length_size>c</log_10_length_size> Input_file_1 (eg. sample.txt) SDFSDGDGSFGRTREREYWW Parameter: a is equal to the input file name b is equal to the total length of... (2 Replies)
Discussion started by: perl_beginner
2 Replies

7. Shell Programming and Scripting

Unfold the data from a input file and write to a file

I am working on a script to unfold data for each column from a specific line of data and write output in a single line. Input data looks like this. 2011-09-26 INF UM_10 UserMana Starting synchronization for security domain 14:37:31 080 gementSe . rvice I... (2 Replies)
Discussion started by: svajhala
2 Replies

8. Shell Programming and Scripting

Help with Bash piped while-read and a read user input at the same time

Hi I am new to writing script and want to use a Bash Piped while-read and read from user input. if something happens on server.log then do while loop or if something happend on user input then do while loop. Pseudocode something like: tail -n 3 -f server.log | while read serverline || read... (8 Replies)
Discussion started by: MyMorris
8 Replies

9. Shell Programming and Scripting

Read input files and merge them in given order and write them to input one param or one file

Dear Friends, I am looking for a shell script to merge input files into one file .. here is my idea: 1st paramter would be outfile file (all input files content) read all input files and merge them to input param 1 ex: if I pass 6 file names to the script then 1st file name as output file... (4 Replies)
Discussion started by: hyd1234
4 Replies

10. Shell Programming and Scripting

How to get the shell script to read the .txt file as an input/data?

i have written my shell script in notepad however i am struggling to pass the data file to be read to the script the data file is of .txt format. My target is to run the shell script from the terminal and pass 3 arguments e.g. polg@DESKTOP-BVPDC5C:~/CS1420/coursework$ bash valsplit.sh input.txt... (11 Replies)
Discussion started by: Gurdza32
11 Replies
des(1)								   User Commands							    des(1)

NAME
des - encrypt or decrypt data using Data Encryption Standard SYNOPSIS
des -e | -d [-bfs] [-k key] [input-file [output-file]] DESCRIPTION
des encrypts and decrypts data using the NBS Data Encryption Standard algorithm. One of -e (for encrypt) or -d (for decrypt) must be spec- ified. The des command is provided to promote secure exchange of data in a standard fashion. Two standard encryption modes are supported by the des program, Cipher Block Chaining (CBC -- the default) and Electronic Code Book (ECB -- specified with -b). CBC mode treats an entire file as a unit of encryption, that is, if insertions or deletions are made to the encrypted file then decryption will not succeed. CBC mode also ensures that regularities in clear data do not appear in the encrypted data. ECB mode treats each 8 bytes as units of encryptions, so if parts of the encrypted file are modified then other parts may still be decrypted. Iden- tical values of clear text encrypt to identical values of cipher text. The key used for the DES algorithm is obtained by prompting the user unless the `-k key' option is given. If the key is an argument to the des command, it is potentially visible to users executing ps(1) or a derivative. To minimize this possibility, des takes care to destroy the key argument immediately upon entry. The des command attempts to use DES hardware for its job, but will use a software implementation of the DES algorithm if the hardware is unavailable. Normally, a warning message is printed if the DES hardware is unavailable since the software is only about 1/50th as fast. However, the -f option will suppress the warning. The -s option may be used to force use of software instead of hardware DES. The des command reads from standard input unless input-file is specified and writes to standard output unless output-file is given. The following sections give information required to implement compatible facilities in other environments. Since the CBC and ECB modes of DES require units of 8 bytes to be encrypted, files being encrypted by the des command have 1 to 8 bytes appended to them to cause them to be a multiple of 8 bytes. The last byte, when decrypted, gives the number of bytes (0 to 7) which are to be saved of the last 8 bytes. The other bytes of those appended to the input are randomized before encryption. If, when decrypting, the last byte is not in the range of 0 to 7 then either the encrypted file has been corrupted or an incorrect key was provided for decryption and an error message is printed. The DES algorithm requires an 8 byte key whose low order bits are assumed to be odd-parity bits. The ASCII key supplied by the user is zero padded to 8 bytes and the high order bits are set to be odd-parity bits. The DES algorithm then ignores the low bit of each ASCII character, but that bit's information has been preserved in the high bit due to the parity. The CBC mode of operation always uses an initial value of all zeros for the initialization vector, so the first 8 bytes of a file are encrypted the same whether in CBC or ECB mode. OPTIONS
-b Select ECB (eight bytes at a time) encryption mode. -d Decrypt data. -e Encrypt data. -f Suppress warning message when software implementation is used. -s Select software implementation for the encryption algorithm. -kkey Use the encryption key specified. FILES
/dev/des? SEE ALSO
ps(1) BUGS
It would be better to use a real 56-bit key rather than an ASCII-based 56-bit pattern. Knowing that the key was derived from ASCII radi- cally reduces the time necessary for a brute-force cryptographic attack. SunOS 5.11 3 Mar 2008 des(1)
All times are GMT -4. The time now is 07:51 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy