473,385 Members | 1,766 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

User definable letter swapping

How would I write a user defnable letter swapping algorithm? I've
written an Enigma encrypting program, and I need to redo the plugboard
function. Right now, the letter swapping is fixed. I need to allow the
user to swap 23 pairs of characters. As you may have guessed, I'm using
an alphabet of 36 characters, A-Z and 0-9. Thanks!!!!

Jan 5 '07 #1
2 1741
Protoman wrote:
How would I write a user defnable letter swapping algorithm? I've
written an Enigma encrypting program, and I need to redo the plugboard
function. Right now, the letter swapping is fixed. I need to allow the
user to swap 23 pairs of characters. As you may have guessed, I'm using
an alphabet of 36 characters, A-Z and 0-9. Thanks!!!!
Why not put the 18 pairs (36/2!) into a file and read them at program startup?

Bjoern
Jan 5 '07 #2
Protoman wrote:
How would I write a user defnable letter swapping algorithm? I've
written an Enigma encrypting program, and I need to redo the plugboard
function. Right now, the letter swapping is fixed. I need to allow the
user to swap 23 pairs of characters. As you may have guessed, I'm using
an alphabet of 36 characters, A-Z and 0-9. Thanks!!!!
The easy way:

Have two const strings -- one with the cleartext alphabet,
the other with the ciphertext alphabet. Then, whenever the
user enters a character, find it in the cleartext alphabet,
remember the position 'i' at which you found it, return to
the user the i-th character of the cipherthext alphabet.

The more-difficult way:

Use a std::map, indexed by the cleartext characters
in which you store ciphertext characters.

If you want these alphabets to be changed without
having to recompile the program, follow Bjoern's suggestion.

HTH,
- J.

HTH,
- J.
Jan 5 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Anne Lynn | last post by:
I have a query where I defined three fields must match - Physician, Date of Service and Claim#. No problem. Now I need to add parameters that allow a user to define a 4th field= Procedure Codes. ...
28
by: rajendra.stalekar | last post by:
Hi Folks!!! I have a string let's say "hi" and got to reverse it using just a single variable for swapping, how do I do it? Regards, Rajendra S.
5
by: Mike Mascari | last post by:
I'd like to ensure that the creation of a department also implies the creation of two to eight projects; no more, no less: CREATE TABLE departments ( department text primary key not null ); ...
1
by: Bob Alston | last post by:
Anyone have experience in building Access apps with user definable fields? (Not the kind of fields where you just let the user define the label for a pre set number of predefined fields.) I...
13
by: Mickey | last post by:
Hi all, Currently I use a timestamp to log users out after 15 minutes of inactivity. However I also need to log a user out if they have just left the page. I need to do this because I store...
8
by: Luke Matuszewski | last post by:
Hi ! I have faced the problem of checking that the user has entered the unicode letter (not only ASCII set of letters...). It seems that ECMAScript 3rd regular expressions do not include posix...
1
by: Rune Jacobsen | last post by:
Hi all, I have some often-performed tasks in my applications that I want users to be able to specify hotkeys for. However, I don't want to hard code these hotkeys, as sooner or later some other...
2
by: wildThought | last post by:
I have a window with a user control on it. I want to be able to swap out different user controls depending on a menu choice. The swappable user controls UserControlBaseA and UserControlBaseB are...
1
by: kang jia | last post by:
hi when user entered particulars in signuppage and click" signup" button, i will direct them to do_signup.php. if say the NRIC is dupicate in datebase, i will redirect them back to signup page...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.