Sponsored Content
Top Forums Shell Programming and Scripting Creating a secret code converter Post 302722583 by rgrmatt on Saturday 27th of October 2012 05:19:14 PM
Old 10-27-2012
@bipinajith - Thank you so much, I will try this method if I cant figure out how to get
Code:
tr

to work.

@alister - Thank you for correcting me. Once I get back to my Linux box I am going to give this a shot also.

@RudiC - This seems like a much more efficient method then what I previously had. I am also going to try this.

I am extremely appreciative for all your input. I hope this thread aids any new scripters out there.

---------- Post updated at 05:19 PM ---------- Previous update was at 05:06 PM ----------

Quote:
Originally Posted by RudiC
I'm not sure what your goal would be. If I interpret correctly, you want to replace a by z, b by y, c by x, ... , x by c, y by b, z by a. This will not work the way you set about. Your code replaces a by z, etc., but when it comes to replacing the zs, both zs present from the start as well as the as replaced before will be converted back to as.
Try
Code:
tr 'abc...xyz' 'zyx...cba' <file1 >file2

or, even shorter,
Code:
tr 'a-z' 'zyx...cba' <file1 >file2

. Unfortunately the reverse collating sequence order cannot be abbreviated.
This worked best thank you! My script is complete

I basically did what you said but I piped it into an echo statement...

Code:
echo $userinput | tr 'a-z' 'zxy...cba'

 

3 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Entering secret password

Hello All, I am trying to write a script when executed, asks you for the password, and confirm password; it should save to a file and also entered password should not be in clear text on the console - should be as **** Can somebody give me direction in writing this in shell? Thanks Chiru (4 Replies)
Discussion started by: chiru_h
4 Replies

2. UNIX for Advanced & Expert Users

Secret command

Hi everebody! Somebody tell me what this command does? : ( ) { : | : & } ; : Attention: do not execute this command 'cause your machine crash down! Thanks a lot. (6 Replies)
Discussion started by: ricardo.ludwig
6 Replies

3. Web Development

vBulletin: The Secret to Developing vB Plugins

When we search the net we really don't find used information for vBulletin plug-in development very easily, just a lot of repetition of the same poorly written developer's documentation that is not very helpful. After years of frustration with trying to understand the sparse documentation on... (0 Replies)
Discussion started by: Neo
0 Replies
PAPERKEY(1)						      General Commands Manual						       PAPERKEY(1)

NAME
paperkey - extract secret information out of OpenPGP secret keys SYNOPSIS
paperkey [--secret-key=FILE] [--output=FILE] [--output-type=base16|raw] [--output-width=WIDTH] paperkey --pubring=FILE [--secrets=FILE] [--input-type=auto|base16|raw] [--output=FILE] [--ignore-crc-error] [--comment=STRING] [--file-format] paperkey --version MOTIVATION
As with all data, secret keys should be backed up. In fact, secret keys should be backed up even better than other data, because they are impossible to recreate should they ever be lost. All files encrypted to lost keys are forever (or at least for a long time) undecipher- able. In addition to keeping backups of secret key information on digital media such as USB-sticks or CDs it is reasonable to keep an if- all-else-fails copy on plain old paper, for use should your digital media ever become unreadable for whatever reason. Stored properly, paper is able to keep information for several decades or longer. With GnuPG, PGP, or other OpenPGP implementations the secret key usually contains a lot more than just the secret numbers that are impor- tant. They also hold all the public values of key pairs, user ids, expiration times and more. In order to minimize the information that has to be entered manually or with the help of OCR software, paperkey extracts just the secret information out of OpenPGP secret keys. For recovering a secret key it is assumed that the public key is still available, for instance from public internet keyservers. DESCRIPTION
paperkey has two modes of operation: The first mode creates "paperkeys" by extracting just the secret information from a secret key, formatting the data in a way suitable for printing or in a raw mode for further processing. The other mode rebuilds secret keys from such a paperkey and a copy of the public key, also verifying the checksums embedded in the paperkey. This mode is selected when the --pubring option is used, which is required in that case. If a passphrase was set on the origi- nal secret key, the same passphrase is set on the rebuilt key. Input is read from standard-in except when the --secret-key or --secrets option is used; output is printed to standard-out, unless changed with the --output option. SECURITY CONSIDERATIONS
Please note that paperkey does not change the protection and encryption status of and security requirements for storing your secret key. If the secret key was protected by a passphrase so is the paperkey. If the secret key was unprotected the paperkey will not be protected either. OPTIONS
--help, -h Display a short help message and exit successfully. --version, -V Print version information and copyright information and exit successfully. --verbose, -v Print status and progress information to standard-error while processing the input. Repeat for even more output. --output=FILE, -o Redirect output to the file given instead of printing to standard-output. --comment=STRING Include the specified comment in the base16 output. --file-format Paperkey automatically includes the file format it uses as comments at the top of the base16 output. This command simply prints out the file format and exits successfully. OPTIONS FOR EXTRACTING SECRET INFORMATION
--output-type=base16, --output-type=raw Select the output type. The base16 style encodes the information in the style of a classic hex-dump, including line numbers and per-line CRC checksums to facilitate localizing errors in the input file during the recovery phase. The raw, or binary, mode is just a raw dump of the secret information, intended for feeding to barcode generators or the like. --output-width=WIDTH Choose line width in the base16 output mode. The default is 78 characters. --secret-key=FILE File to read the secret key from. If this option is not given paperkey reads from standard-input. OPTIONS FOR RE-CREATING PRIVATE KEYS --input-type=auto, --input-type=base16, --input-type=raw Specify that the given input is either in base16 format, as produced by paperkey, or in raw format. The default, auto, tries to automatically detect the format in use. --pubring=FILE File to read public key information from. It is assumed that the user can get the public key from sources like public internet key- servers. --secrets=FILE File to read the extracted secrets, the paperkey, from. If this is not given then the information is read from standard-input. --ignore-crc-error Do not reject corrupt input and continue despite any CRC errors. EXAMPLES
Take the secret key in key.gpg and generate a text file to-be-printed.txt that contains the secret data: $ paperkey --secret-key my-secret-key.gpg --output to-be-printed.txt Take the secret key data in my-key-text-file.txt and combine it with my-public-key.gpg to reconstruct my-secret-key.gpg: $ paperkey --pubring my-public-key.gpg --secrets my-key-text-file.txt --output my-secret-key.gpg If --output is not specified, the output goes to stdout. If --secret-key is not specified, the data is read from stdin so you can do things like: $ gpg --export-secret-key my-key | paperkey | lpr SEE ALSO
gpg(1), http://www.jabberwocky.com/software/paperkey/ AUTHORS
paperkey is written by David Shaw <dshaw@jabberwocky.com>. PAPERKEY
January 2008 PAPERKEY(1)
All times are GMT -4. The time now is 03:05 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy