473,388 Members | 1,209 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,388 software developers and data experts.

Any way to make this code more compact, and/or be able to change at runtime?

I've written this program that simulates a 36 character, 10 rotor
reciprocal rotor cipher, w/ a plugboard. Any way I can make the
plugboard function more compact and/or be able to change the mapping
at runtime?

char Enigma::plugboard(char Char)
{
if(Char=='A')
return '0';
else if(Char=='B')
return 'Q';
else if(Char=='C')
return 'W';
else if(Char=='D')
return 'E';
else if(Char=='E')
return 'D';
else if(Char=='F')
return 'T';
else if(Char=='G')
return 'Y';
else if(Char=='H')
return 'U';
else if(Char=='I')
return 'I';
else if(Char=='J')
return 'O';
else if(Char=='K')
return 'P';
else if(Char=='L')
return 'S';
else if(Char=='M')
return 'N';
else if(Char=='N')
return 'M';
else if(Char=='O')
return 'J';
else if(Char=='P')
return 'K';
else if(Char=='Q')
return 'B';
else if(Char=='R')
return 'Z';
else if(Char=='S')
return 'L';
else if(Char=='T')
return 'F';
else if(Char=='U')
return 'H';
else if(Char=='V')
return 'X';
else if(Char=='W')
return 'C';
else if(Char=='X')
return 'V';
else if(Char=='Y')
return 'G';
else if(Char=='Z')
return 'R';
else if(Char=='0')
return 'A';
else if(Char=='1')
return '9';
else if(Char=='2')
return '8';
else if(Char=='3')
return '7';
else if(Char=='4')
return '6';
else if(Char=='5')
return '5';
else if(Char=='6')
return '4';
else if(Char=='7')
return '3';
else if(Char=='8')
return '2';
else if(Char=='9')
return '1';
}

If you need any more info, just ask and I'll produce it. Thanks!!!!

Jul 3 '07 #1
26 2043
Protoman wrote:
I've written this program that simulates a 36 character, 10 rotor
reciprocal rotor cipher, w/ a plugboard. Any way I can make the
plugboard function more compact and/or be able to change the mapping
at runtime?
In this situation, a switch might be more compact:

switch (Char) {
case 'A': return '0';
case 'B': return 'Q';
....
}

If you want to change at runtime:
#include <map>

class Enigma {
std::map<char, charplug;
public:
char plugboard(char Char) {
return plug[Char];
}
....
};
--
rbh
Jul 3 '07 #2
On 2 Jul, 20:10, Robert Bauck Hamar <roberth+n...@ifi.uio.nowrote:
Protoman wrote:
I've written this program that simulates a 36 character, 10 rotor
reciprocal rotor cipher, w/ a plugboard. Any way I can make the
plugboard function more compact and/or be able to change the mapping
at runtime?

In this situation, a switch might be more compact:

switch (Char) {
case 'A': return '0';
case 'B': return 'Q';
...

}

If you want to change at runtime:
#include <map>

class Enigma {
std::map<char, charplug;
public:
char plugboard(char Char) {
return plug[Char];
}
...

};

--
rbh
Oh, and the encrypt() doesn't work right...it just returns the first
char of the cleartext:

string Enigma::Encrypt(const string& cleartext)
{
string ciphertext;
ciphertext.resize(cleartext.size());
unsigned int i=0;
for(;i<cleartext.length();i++)
{
int val=Rotor::CharacterMap(plugboard(cleartext[i]));
if (val<36)
{
char val1 = R1.GetCharacterIndex(val);
int val2 = Rotor::CharacterMap(val1);
char val3 = R2.GetCharacterIndex(val2);
int val4 = Rotor::CharacterMap(val3);
char val5 = R3.GetCharacterIndex(val4);
int val6 = Rotor::CharacterMap(val5);
char val7 = R4.GetCharacterIndex(val6);
int val8 = Rotor::CharacterMap(val7);
char val9=R5.GetCharacterIndex(val8);
int val10 = Rotor::CharacterMap(val9);
char val11=R6.GetCharacterIndex(val10);
int val12=Rotor::CharacterMap(val11);
char val13=R7.GetCharacterIndex(val12);
int val14=Rotor::CharacterMap(val13);
char val15=R8.GetCharacterIndex(val14);
int val16=Rotor::CharacterMap(val15);
char val17=R9.GetCharacterIndex(val16);
int val18=Rotor::CharacterMap(val17);
char val19=R10.GetCharacterIndex(val18);
int val20=Rotor::CharacterMap(val19);
char val21 = Enigma::Reflector[val20];
int val22 = Rotor::CharacterMap(val21);
char val23 = R10.GetCharacterInverse(val22);
int val24 = Rotor::CharacterMap(val23);
char val25 = R9.GetCharacterInverse(val24);
int val26 = Rotor::CharacterMap(val25);
char val27 = R8.GetCharacterInverse(val26);
int val28 = Rotor::CharacterMap(val27);
char val29 = R7.GetCharacterInverse(val28);
int val30 = Rotor::CharacterMap(val29);
char val31 = R6.GetCharacterInverse(val30);
int val32=Rotor::CharacterMap(val31);
char val33=R5.GetCharacterIndex(val32);
int val34=Rotor::CharacterMap(val33);
char val35=R4.GetCharacterIndex(val34);
int val36=Rotor::CharacterMap(val35);
char val37=R3.GetCharacterIndex(val36);
int val38=Rotor::CharacterMap(val37);
char val39=R2.GetCharacterIndex(val38);
int val40=Rotor::CharacterMap(val39);
char val41=R1.GetCharacterIndex(val40);
ciphertext[i] = plugboard(val41);
R1.AdvanceRotor(1);
if((R1.GetSteps()%36)==0)
{
R2.AdvanceRotor(1);
if((R2.GetSteps()%36)==0)
{
R3.AdvanceRotor(1);
if((R3.GetSteps()%36)==0)
{
R4.AdvanceRotor(1);
if((R4.GetSteps()%36)==0)
R5.AdvanceRotor(1);
{
if((R5.GetSteps()%36)==0)
R6.AdvanceRotor(1);
{
if((R6.GetSteps()%36)==0)
R7.AdvanceRotor(1);
{
if((R7.GetSteps()%36)==0)
R8.AdvanceRotor(1);
{
if((R8.GetSteps()%36)==0)
R9.AdvanceRotor(1);
{
if((R9.GetSteps()%36)==0)
R10.AdvanceRotor(1);
}
}
}
}
}
}
}
} // problem #2 missing brace
else {ciphertext[i] = cleartext[i];}
}
return ciphertext;
}
}

Jul 3 '07 #3
Protoman wrote:
I've written this program that simulates a 36 character, 10 rotor
reciprocal rotor cipher, w/ a plugboard. Any way I can make the
plugboard function more compact and/or be able to change the mapping
at runtime?

char Enigma::plugboard(char Char)
{
if(Char=='A')
return '0';
else if(Char=='B')
return 'Q';
....

Put all the outputs in a char array[] = {'0', 'Q', ...};
return array[Char - 'A'];

To change the mapping at run time you could read a file into the array.

--
Scott McPhillips [MVP VC++]

Jul 3 '07 #4

"Protoman" <Pr**********@gmail.comwrote in message
news:11*********************@e9g2000prf.googlegrou ps.com...
I've written this program that simulates a 36 character, 10 rotor
reciprocal rotor cipher, w/ a plugboard. Any way I can make the
plugboard function more compact and/or be able to change the mapping
at runtime?

char Enigma::plugboard(char Char)
{
if(Char=='A')
return '0';
else if(Char=='B')
return 'Q';
else if(Char=='C')
return 'W';
else if(Char=='D')
return 'E';
else if(Char=='E')
return 'D';
else if(Char=='F')
return 'T';
else if(Char=='G')
return 'Y';
else if(Char=='H')
return 'U';
else if(Char=='I')
return 'I';
else if(Char=='J')
return 'O';
else if(Char=='K')
return 'P';
else if(Char=='L')
return 'S';
else if(Char=='M')
return 'N';
else if(Char=='N')
return 'M';
else if(Char=='O')
return 'J';
else if(Char=='P')
return 'K';
else if(Char=='Q')
return 'B';
else if(Char=='R')
return 'Z';
else if(Char=='S')
return 'L';
else if(Char=='T')
return 'F';
else if(Char=='U')
return 'H';
else if(Char=='V')
return 'X';
else if(Char=='W')
return 'C';
else if(Char=='X')
return 'V';
else if(Char=='Y')
return 'G';
else if(Char=='Z')
return 'R';
else if(Char=='0')
return 'A';
else if(Char=='1')
return '9';
else if(Char=='2')
return '8';
else if(Char=='3')
return '7';
else if(Char=='4')
return '6';
else if(Char=='5')
return '5';
else if(Char=='6')
return '4';
else if(Char=='7')
return '3';
else if(Char=='8')
return '2';
else if(Char=='9')
return '1';
}

If you need any more info, just ask and I'll produce it. Thanks!!!!
I can think of a few ways to do it more compact. a std::map would be one
way, although you'd still have to add the members to the map. I think it
depends on what is your primary concern, speed of execution or
maintanability. One simple thing, however, is that you only have the
letters 'A' through 'Z' and the digits '0' through '9'.

Consider something like the following (untested bug ridden) code:

char Enigma::plugboard(char Char)
{
char Vallues* = "0QWEDTYU'I'OPSNMJKBZLFHXCVGRA987654321"
if ( Char >= 'A' && Char <= 'Z' )
return Values[Char - 'A'];
else if ( Char >= '0' && Char <= '0' )
return Values[ 26 + Char - '0' ];
else
return 0;
)

However, this will only work on platforms where 'A' through 'Z' and '0'
through '9' are contiguous (ASCII, wouldn't work in EBSIDIC (sp?) ).
You can also create an array to find the postion:
char Characters* = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
so find the Char in Characters, get it's postion, return Values[Position];

Now, this is more compact, and you can change what Values points at (make it
array, pass in a pointer, whatever).
Jul 3 '07 #5
On 2 Jul, 20:43, "Scott McPhillips [MVP]" <org-dot-mvps-at-scottmcp>
wrote:
Protoman wrote:
I've written this program that simulates a 36 character, 10 rotor
reciprocal rotor cipher, w/ a plugboard. Any way I can make the
plugboard function more compact and/or be able to change the mapping
at runtime?
char Enigma::plugboard(char Char)
{
if(Char=='A')
return '0';
else if(Char=='B')
return 'Q';

...

Put all the outputs in a char array[] = {'0', 'Q', ...};
return array[Char - 'A'];

To change the mapping at run time you could read a file into the array.

--
Scott McPhillips [MVP VC++]
OK, did that, but:

1. How do I get it to be able be changed w/ a text file, and
2. What's wrong w/ Encrypt()?

Thanks!!!

Jul 3 '07 #6
On Jul 3, 12:00 pm, Protoman <Protoman2...@gmail.comwrote:
I've written this program that simulates a 36 character, 10 rotor
reciprocal rotor cipher, w/ a plugboard. Any way I can make the
plugboard function more compact and/or be able to change the mapping
at runtime?

char Enigma::plugboard(char Char)
{
if(Char=='A')
return '0';
else if(Char=='B')
return 'Q';
else if(Char=='C')
return 'W';
else if(Char=='D')
return 'E';
else if(Char=='E')
return 'D';
else if(Char=='F')
return 'T';
else if(Char=='G')
return 'Y';
else if(Char=='H')
return 'U';
else if(Char=='I')
return 'I';
else if(Char=='J')
return 'O';
else if(Char=='K')
return 'P';
else if(Char=='L')
return 'S';
else if(Char=='M')
return 'N';
else if(Char=='N')
return 'M';
else if(Char=='O')
return 'J';
else if(Char=='P')
return 'K';
else if(Char=='Q')
return 'B';
else if(Char=='R')
return 'Z';
else if(Char=='S')
return 'L';
else if(Char=='T')
return 'F';
else if(Char=='U')
return 'H';
else if(Char=='V')
return 'X';
else if(Char=='W')
return 'C';
else if(Char=='X')
return 'V';
else if(Char=='Y')
return 'G';
else if(Char=='Z')
return 'R';
else if(Char=='0')
return 'A';
else if(Char=='1')
return '9';
else if(Char=='2')
return '8';
else if(Char=='3')
return '7';
else if(Char=='4')
return '6';
else if(Char=='5')
return '5';
else if(Char=='6')
return '4';
else if(Char=='7')
return '3';
else if(Char=='8')
return '2';
else if(Char=='9')
return '1';

}

If you need any more info, just ask and I'll produce it. Thanks!!!!
If your routine has definite algorithm, it's better to to return the
values with some mathematical expressions that would be better.

I've managed to optimize your problems as follows with look-up table.

See the sample snippet below. Hope you can understand my code. I'm not
explaining it :)

// Look up table
const char buff[] =
{
'0','Q','W','E','D','T','Y','U','I','O','P','S',
'N','M','J','K','B','Z','L','F','H','X','C','V',
'G','R','A','9','8','7','6','5','4','3','2','1'
};

char Plugboard(char Char)
{
// Check the ASCII Table for the values
if( Char >= 48 && Char <= 57 )// '0' to '9' range validating
return buff[Char-48+26];
else if( Char >= 65 && Char <= 90 ) // 'A' to 'Z' range validating
return buff[Char-65];
else
return '\0';

}

int main(int argc, char* argv[])
{
cout<<Plugboard( 'R' );
return 0;
}

HTH

Regards,
Sarath
http://sarathc.wordpress.com/

Jul 3 '07 #7

Jim Langston wrote in message...
>
"Protoman" <Pr**********@gmail.comwrote in message...
char Enigma::plugboard(char Char){
}
If you need any more info, just ask and I'll produce it. Thanks!!!!

I can think of a few ways to do it more compact. a std::map would be one
way, although you'd still have to add the members to the map. I think it
depends on what is your primary concern, speed of execution or
maintanability. One simple thing, however, is that you only have the
letters 'A' through 'Z' and the digits '0' through '9'.

Consider something like the following (untested bug ridden) code:

char Enigma::plugboard(char Char)
{
char Vallues* = "0QWEDTYU'I'OPSNMJKBZLFHXCVGRA987654321"
if ( Char >= 'A' && Char <= 'Z' )
return Values[Char - 'A'];
else if ( Char >= '0' && Char <= '0' )
return Values[ 26 + Char - '0' ];
else
return 0;
)

However, this will only work on platforms where 'A' through 'Z' and '0'
through '9' are contiguous (ASCII, wouldn't work in EBSIDIC (sp?) ).
You can also create an array to find the postion:
char Characters* = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
so find the Char in Characters, get it's postion, return Values[Position];

Now, this is more compact, and you can change what Values points at (make
it
array, pass in a pointer, whatever).
Take it a step further, maybe:

char plugboard( char Char ){
std::string Values
( "0QWEDTYUIOPSNMJKBZLFHXCVGRA987654321" );
std::string Characters
( "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" );
std::size_t index( Characters.find( Char ) );
if( std::string::npos == index ){ return ' ';}
return Values.at( index );
} // plugboard(char)

{ // main or ?
std::string Vals( "NOWISTHETIMEFOR2007" );
// std::string Vals( "NOW IS THE TIME FOR 2007" );
std::cout<<"Vals:\n"<<Vals<<std::endl;
for( std::size_t i(0); i < Vals.size(); ++i){
std::cout<< plugboard( Vals.at(i) );
}
} // main()
/* Vals:
NOWISTHETIMEFOR2007
MJCILFUDFINDTJZ8AA3

NOW IS THE TIME FOR 2007
MJC IL FUD FIND TJZ 8AA3
*/

--
Bob R
POVrookie
Jul 3 '07 #8
On 2 Jul, 23:09, "BobR" <removeBadB...@worldnet.att.netwrote:
Jim Langston wrote in message...
"Protoman" <Protoman2...@gmail.comwrote in message...
char Enigma::plugboard(char Char){
}
If you need any more info, just ask and I'll produce it. Thanks!!!!
I can think of a few ways to do it more compact. a std::map would be one
way, although you'd still have to add the members to the map. I think it
depends on what is your primary concern, speed of execution or
maintanability. One simple thing, however, is that you only have the
letters 'A' through 'Z' and the digits '0' through '9'.
Consider something like the following (untested bug ridden) code:
char Enigma::plugboard(char Char)
{
char Vallues* = "0QWEDTYU'I'OPSNMJKBZLFHXCVGRA987654321"
if ( Char >= 'A' && Char <= 'Z' )
return Values[Char - 'A'];
else if ( Char >= '0' && Char <= '0' )
return Values[ 26 + Char - '0' ];
else
return 0;
)
However, this will only work on platforms where 'A' through 'Z' and '0'
through '9' are contiguous (ASCII, wouldn't work in EBSIDIC (sp?) ).
You can also create an array to find the postion:
char Characters* = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
so find the Char in Characters, get it's postion, return Values[Position];
Now, this is more compact, and you can change what Values points at (make
it
array, pass in a pointer, whatever).

Take it a step further, maybe:

char plugboard( char Char ){
std::string Values
( "0QWEDTYUIOPSNMJKBZLFHXCVGRA987654321" );
std::string Characters
( "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" );
std::size_t index( Characters.find( Char ) );
if( std::string::npos == index ){ return ' ';}
return Values.at( index );
} // plugboard(char)

{ // main or ?
std::string Vals( "NOWISTHETIMEFOR2007" );
// std::string Vals( "NOW IS THE TIME FOR 2007" );
std::cout<<"Vals:\n"<<Vals<<std::endl;
for( std::size_t i(0); i < Vals.size(); ++i){
std::cout<< plugboard( Vals.at(i) );
}
} // main()
/* Vals:
NOWISTHETIMEFOR2007
MJCILFUDFINDTJZ8AA3

NOW IS THE TIME FOR 2007
MJC IL FUD FIND TJZ 8AA3
*/

--
Bob R
POVrookie- Hide quoted text -

- Show quoted text -
OK ,but a couple posts ago, I said the Encrypt() isn't working right;
it only returns the first letter of the cleartext.

Jul 3 '07 #9

Protoman <Pr**********@gmail.comwrote in message...
>
OK ,but a couple posts ago, I said the Encrypt() isn't working right;
it only returns the first letter of the cleartext.
And you could probably get help with that IF you provide enough code, and
give a clear explanation of what it is doing/not doing. Format your code
(indent (NO tabs)) so we can read it.

string Enigma::Encrypt(const string& cleartext){
string ciphertext;
ciphertext.resize(cleartext.size());
unsigned int i=0;
for(;i<cleartext.length();i++){
int val=Rotor::CharacterMap(plugboard(cleartext[i]));
if (val<36){
char val1 = R1.GetCharacterIndex(val);
int val2 = Rotor::CharacterMap(val1);

What is 'Rotor::CharacterMap()'?
What is 'R1.GetCharacterIndex()'?
.... etc.

--
Bob R
POVrookie
Jul 3 '07 #10
On 3 Jul, 12:29, "BobR" <removeBadB...@worldnet.att.netwrote:
Protoman <Protoman2...@gmail.comwrote in message...
OK ,but a couple posts ago, I said the Encrypt() isn't working right;
it only returns the first letter of the cleartext.

And you could probably get help with that IF you provide enough code, and
give a clear explanation of what it is doing/not doing. Format your code
(indent (NO tabs)) so we can read it.

string Enigma::Encrypt(const string& cleartext){
string ciphertext;
ciphertext.resize(cleartext.size());
unsigned int i=0;
for(;i<cleartext.length();i++){
int val=Rotor::CharacterMap(plugboard(cleartext[i]));
if (val<36){
char val1 = R1.GetCharacterIndex(val);
int val2 = Rotor::CharacterMap(val1);

What is 'Rotor::CharacterMap()'?
What is 'R1.GetCharacterIndex()'?
... etc.

--
Bob R
POVrookie
OK, here's the complete files:

Enigma.hpp
---------------
#ifndef ENIGMA_HPP
#define ENIGMA_HPP
#include <iostream>
#include <string>
using namespace std;
class Error{};
class Rotor
{
public:
Rotor(char pos=0):CurPos(0),steps(0)
{
memcpy(Alphabet,"ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456 789",36);
SetRotorPosition(CharacterMap(pos));
}
int GetSteps()const{return steps;}
static int CharacterMap(char the_char)
{
static const char *alphabet =
"ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
const char* p;
if (p=strchr(alphabet, the_char))
return (p-alphabet);
else
throw Error();
}
void SetRotorPosition(int NewPos)
{
while(NewPos < 0)
{
NewPos+=36;
}
CurPos=NewPos%36;
steps=0;
}
void AdvanceRotor(int Steps)
{
CurPos += Steps;
while(CurPos < 0)
{
CurPos +=36;
}
CurPos %=36;
steps+=Steps%36;
}
void ReverseRotor(int Steps)
{
AdvanceRotor(-Steps);
}
char GetCurrentCharacter()const
{
return Alphabet[CurPos];
}
char GetCharacterIndex(int Index)const
{
return Alphabet[(CurPos+Index)%36];
}
char GetCharacterInverse(int i)const
{
if (i>=CurPos)
return Alphabet[i - CurPos];
else
return Alphabet[36 + i - CurPos];
}
private:
char Alphabet[36];
int CurPos;
int steps;
};

class Enigma
{
public:
Enigma(char r1,char r2,char r3,char r4,char r5,char r6,char r7,char
r8,char r9,char r10):
R1(r1),R2(r2),R3(r3),R4(r4),R5(r5),R6(r6),R7(r7),R 8(r8),R9(r9),R10(r10)
{
memcpy(Reflector,"COAYIWV7E3809TBUZ26NPGF4DQL5RJX1 SHKM",36);
}
~Enigma(){}
string Encrypt(const string& cleartext);
string Decrypt(const string& ciphertext);
private:
char plugboard(char plugboard);
Rotor R1;
Rotor R2;
Rotor R3;
Rotor R4;
Rotor R5;
Rotor R6;
Rotor R7;
Rotor R8;
Rotor R9;
Rotor R10;
char Reflector[36];
};
#endif
--------------------

Enigma.cpp
------------------
#include "Enigma.hpp"
#include <string>
using namespace std;

char Enigma::plugboard(char Char)
{
char array[]="ZAQ1XSW2CDE3VFR4BGT5NHY6MJU7KI8LO9P0";
return array[Char-'A'];
}

string Enigma::Encrypt(const string& cleartext)
{
string ciphertext;
ciphertext.resize(cleartext.size());
unsigned int i=0;
for(;i<cleartext.length();i++)
{
int val=Rotor::CharacterMap(plugboard(cleartext[i]));
if (val<36)
{
char val1 = R1.GetCharacterIndex(val);
int val2 = Rotor::CharacterMap(val1);
char val3 = R2.GetCharacterIndex(val2);
int val4 = Rotor::CharacterMap(val3);
char val5 = R3.GetCharacterIndex(val4);
int val6 = Rotor::CharacterMap(val5);
char val7 = R4.GetCharacterIndex(val6);
int val8 = Rotor::CharacterMap(val7);
char val9=R5.GetCharacterIndex(val8);
int val10 = Rotor::CharacterMap(val9);
char val11=R6.GetCharacterIndex(val10);
int val12=Rotor::CharacterMap(val11);
char val13=R7.GetCharacterIndex(val12);
int val14=Rotor::CharacterMap(val13);
char val15=R8.GetCharacterIndex(val14);
int val16=Rotor::CharacterMap(val15);
char val17=R9.GetCharacterIndex(val16);
int val18=Rotor::CharacterMap(val17);
char val19=R10.GetCharacterIndex(val18);
int val20=Rotor::CharacterMap(val19);
char val21 = Enigma::Reflector[val20];
int val22 = Rotor::CharacterMap(val21);
char val23 = R10.GetCharacterInverse(val22);
int val24 = Rotor::CharacterMap(val23);
char val25 = R9.GetCharacterInverse(val24);
int val26 = Rotor::CharacterMap(val25);
char val27 = R8.GetCharacterInverse(val26);
int val28 = Rotor::CharacterMap(val27);
char val29 = R7.GetCharacterInverse(val28);
int val30 = Rotor::CharacterMap(val29);
char val31 = R6.GetCharacterInverse(val30);
int val32=Rotor::CharacterMap(val31);
char val33=R5.GetCharacterIndex(val32);
int val34=Rotor::CharacterMap(val33);
char val35=R4.GetCharacterIndex(val34);
int val36=Rotor::CharacterMap(val35);
char val37=R3.GetCharacterIndex(val36);
int val38=Rotor::CharacterMap(val37);
char val39=R2.GetCharacterIndex(val38);
int val40=Rotor::CharacterMap(val39);
char val41=R1.GetCharacterIndex(val40);
ciphertext[i] = plugboard(val41);
R1.AdvanceRotor(1);
if((R1.GetSteps()%36)==0)
{
R2.AdvanceRotor(1);
if((R2.GetSteps()%36)==0)
{
R3.AdvanceRotor(1);
if((R3.GetSteps()%36)==0)
{
R4.AdvanceRotor(1);
if((R4.GetSteps()%36)==0)
R5.AdvanceRotor(1);
{
if((R5.GetSteps()%36)==0)
R6.AdvanceRotor(1);
{
if((R6.GetSteps()%36)==0)
R7.AdvanceRotor(1);
{
if((R7.GetSteps()%36)==0)
R8.AdvanceRotor(1);
{
if((R8.GetSteps()%36)==0)
R9.AdvanceRotor(1);
{
if((R9.GetSteps()%36)==0)
R10.AdvanceRotor(1);
}
}
}
}
}
}
}
} // problem #2 missing brace
else {ciphertext[i] = cleartext[i];}
}
return ciphertext;
}
}
----------------------

EnigmaMain.cpp
----------------------
#include "Enigma.hpp"
#include <iostream>
#include <string>
using namespace std;
int main()
{
start:
bool mode;
cout << "Encrypt or decrypt?[Encrypt=1|Decrypt=0]: " << endl;
cin >mode;
try
{
if(mode==1)
{
cout << "Enter the rotor settings: " << endl;
char R1,R2,R3,R4,R5,R6,R7,R8,R9,R10;
cin >R1 >R2 >R3 >R4 >R5 >R6 >R7 >R8 >R9 >R10;
Enigma encryptor(R1,R2,R3,R4,R5,R6,R7,R8,R9,R10);
cin.ignore(1);
string cleartext;
cout << "Enter cleartext: " << endl;
getline(cin,cleartext);
string ciphertext(encryptor.Encrypt(cleartext));
cout << "Ciphertext: " << ciphertext << endl;
}
if(mode==0)
{
cout << "Enter the rotor settings: " << endl;
char R1,R2,R3,R4,R5,R6,R7,R8,R9,R10;
cin >R1 >R2 >R3 >R4 >R5 >R6 >R7 >R8 >R9 >R10;
Enigma decryptor(R1,R2,R3,R4,R5,R6,R7,R8,R9,R10);
cin.ignore(1);
string ciphertext;
cout << "Enter ciphertext: " << endl;
getline(cin,ciphertext);
string cleartext(decryptor.Encrypt(ciphertext));
cout << "Cleartext: " << cleartext << endl;
}
goto start;
}
catch(Error& obj)
{
cout << "Error. \a" << endl;
goto start;
}
return 0;
}
----------------------

Now do you guys have enough info to help me? Thanks!!!!

Jul 3 '07 #11
Protoman wrote:
OK ,but a couple posts ago, I said the Encrypt() isn't working right;
it only returns the first letter of the cleartext.
[...]
string Enigma::Encrypt(const string& cleartext)
{
string ciphertext;
ciphertext.resize(cleartext.size());
unsigned int i=0;
for(;i<cleartext.length();i++)
{
[...code snipped...]
return ciphertext;
}
}
[...]
Now do you guys have enough info to help me? Thanks!!!!
I can't see through your __missing indentation__, but is this
return-statement really inside the for-loop body? That would explain, why
the function returns the first letter only: The loop body only gets
executed once.

--
Thomas
http://www.netmeister.org/news/learn2quote.html
Jul 3 '07 #12
On 3 Jul, 13:43, "Thomas J. Gritzan" <Phygon_ANTIS...@gmx.dewrote:
Protoman wrote:
OK ,but a couple posts ago, I said the Encrypt() isn't working right;
it only returns the first letter of the cleartext.
[...]
string Enigma::Encrypt(const string& cleartext)
{
string ciphertext;
ciphertext.resize(cleartext.size());
unsigned int i=0;
for(;i<cleartext.length();i++)
{

[...code snipped...]
return ciphertext;
}
}
[...]
Now do you guys have enough info to help me? Thanks!!!!

I can't see through your __missing indentation__, but is this
return-statement really inside the for-loop body? That would explain, why
the function returns the first letter only: The loop body only gets
executed once.

--
Thomashttp://www.netmeister.org/news/learn2quote.html
Oh yeah! Thanks!!!!

Jul 3 '07 #13
On 3 Jul, 13:43, "Thomas J. Gritzan" <Phygon_ANTIS...@gmx.dewrote:
Protoman wrote:
OK ,but a couple posts ago, I said the Encrypt() isn't working right;
it only returns the first letter of the cleartext.
[...]
string Enigma::Encrypt(const string& cleartext)
{
string ciphertext;
ciphertext.resize(cleartext.size());
unsigned int i=0;
for(;i<cleartext.length();i++)
{

[...code snipped...]
return ciphertext;
}
}
[...]
Now do you guys have enough info to help me? Thanks!!!!

I can't see through your __missing indentation__, but is this
return-statement really inside the for-loop body? That would explain, why
the function returns the first letter only: The loop body only gets
executed once.

--
Thomashttp://www.netmeister.org/news/learn2quote.html
OK, now it just returns the cleartext.

Jul 3 '07 #14
On 3 Jul, 14:16, Protoman <Protoman2...@gmail.comwrote:
On 3 Jul, 13:43, "Thomas J. Gritzan" <Phygon_ANTIS...@gmx.dewrote:


Protoman wrote:
OK ,but a couple posts ago, I said the Encrypt() isn't working right;
it only returns the first letter of the cleartext.
[...]
string Enigma::Encrypt(const string& cleartext)
{
string ciphertext;
ciphertext.resize(cleartext.size());
unsigned int i=0;
for(;i<cleartext.length();i++)
{
[...code snipped...]
return ciphertext;
}
}
[...]
Now do you guys have enough info to help me? Thanks!!!!
I can't see through your __missing indentation__, but is this
return-statement really inside the for-loop body? That would explain, why
the function returns the first letter only: The loop body only gets
executed once.
--
Thomashttp://www.netmeister.org/news/learn2quote.html

OK, now it just returns the cleartext.- Hide quoted text -

- Show quoted text -
OK, I think the problem's in plugboard():

char Enigma::plugboard(char Char)
{
char array[]="ZAQ1XSW2CDE3VFR4BGT5NHY6MJU7KI8LO9P0";
return array[Char-'A'];
}

Jul 3 '07 #15

Protoman <Pr**********@gmail.comwrote in message...

OK, now it just returns the cleartext.- Hide quoted text -
- Show quoted text -

OK, I think the problem's in plugboard():

char Enigma::plugboard(char Char){
char array[]="ZAQ1XSW2CDE3VFR4BGT5NHY6MJU7KI8LO9P0";
return array[Char-'A'];
}
std::cout<<"0="<<int('0')<<std::endl; // that's an zero
std::cout<<"A="<<int('A')<<std::endl;
/* -out- (note: may get different results on other systems.)
0=48
A=65
*/
Don't you see a problem with that?
return array[ -17 ]; // really think that will work?

See my first post in this thread!
( which, BTW, works in both directions.)
{
std::string Vals( "NOW IS THE TIME FOR 2007" );
std::string Back;
std::cout<<"Vals:\n"<<Vals<<std::endl;
for( std::size_t i(0); i < Vals.size(); ++i){
Back.push_back( plugboard( Vals.at(i) ) );
std::cout<< plugboard( Vals.at(i) );
}
std::cout<<"\nVals Back:\n"<<Back<<std::endl;
for( std::size_t i(0); i < Back.size(); ++i){
std::cout<< plugboard( Back.at(i) );
}
}
/* Vals:
NOW IS THE TIME FOR 2007
MJC IL FUD FIND TJZ 8AA3
Vals Back:
MJC IL FUD FIND TJZ 8AA3
NOW IS THE TIME FOR 2007
*/

Why don't you TRY things that people show you?

--
Bob R
POVrookie
Jul 3 '07 #16
On 3 Jul, 16:11, "BobR" <removeBadB...@worldnet.att.netwrote:
Protoman <Protoman2...@gmail.comwrote in message...
OK, now it just returns the cleartext.- Hide quoted text -
- Show quoted text -
OK, I think the problem's in plugboard():
char Enigma::plugboard(char Char){
char array[]="ZAQ1XSW2CDE3VFR4BGT5NHY6MJU7KI8LO9P0";
return array[Char-'A'];
}

std::cout<<"0="<<int('0')<<std::endl; // that's an zero
std::cout<<"A="<<int('A')<<std::endl;
/* -out- (note: may get different results on other systems.)
0=48
A=65
*/
Don't you see a problem with that?
return array[ -17 ]; // really think that will work?

See my first post in this thread!
( which, BTW, works in both directions.)
{
std::string Vals( "NOW IS THE TIME FOR 2007" );
std::string Back;
std::cout<<"Vals:\n"<<Vals<<std::endl;
for( std::size_t i(0); i < Vals.size(); ++i){
Back.push_back( plugboard( Vals.at(i) ) );
std::cout<< plugboard( Vals.at(i) );
}
std::cout<<"\nVals Back:\n"<<Back<<std::endl;
for( std::size_t i(0); i < Back.size(); ++i){
std::cout<< plugboard( Back.at(i) );
}}

/* Vals:
NOW IS THE TIME FOR 2007
MJC IL FUD FIND TJZ 8AA3
Vals Back:
MJC IL FUD FIND TJZ 8AA3
NOW IS THE TIME FOR 2007
*/

Why don't you TRY things that people show you?

--
Bob R
POVrookie
B/c I want something simpler than that.

Jul 3 '07 #17

Protoman wrote in message...
>
B/c I want something simpler than that.
Simpler than a five line character translator? Good luck with that.
Actually, it's only a three line function if you pass in the string refs.

char plugboard( char Char, std::string const &Values,
std::string const &Characters ){
std::size_t index( Characters.find( Char ) );
if( std::string::npos == index ){ return ' ';}
return Values.at( index );
}

Even at five lines, it's much better than your original 35 (or two liner
that does not work), and it's easier to change the translations.
(hint: std::vector<std::stringTransTables; plugboard( 'Q',
TransTables.at(5), TransTables.at(0) ) ).

--
Bob R
POVrookie
Jul 4 '07 #18
On 3 Jul, 19:32, "BobR" <removeBadB...@worldnet.att.netwrote:
Protoman wrote in message...
B/c I want something simpler than that.

Simpler than a five line character translator? Good luck with that.
Actually, it's only a three line function if you pass in the string refs.

char plugboard( char Char, std::string const &Values,
std::string const &Characters ){
std::size_t index( Characters.find( Char ) );
if( std::string::npos == index ){ return ' ';}
return Values.at( index );
}

Even at five lines, it's much better than your original 35 (or two liner
that does not work), and it's easier to change the translations.
(hint: std::vector<std::stringTransTables; plugboard( 'Q',
TransTables.at(5), TransTables.at(0) ) ).

--
Bob R
POVrookie
But what do I do w/ the two other parameters in the fn?

Jul 4 '07 #19
On Jul 4, 4:32 am, "BobR" <removeBadB...@worldnet.att.netwrote:
Protoman wrote in message...
B/c I want something simpler than that.
Simpler than a five line character translator? Good luck with that.

Well, character translation per se is usually only one line:
char translated = translationMap[ original ] ;
:-).

The real question, however, is: why a 36 character encoder? Why
not 256 (or more correctly, UCHAR_MAX+1)?

For the rest, there's a complete implementation of encode/decode
using a Enigma machine at my site
(http://kanze.james.neuf.fr/code-en.html, the executable
"crypt"). From the man page for it: "Isn't really useful for
anything. It's not secure enough for real encryption, and is a
lot more complicated than a simple rot13 for the cases where it
would be sufficient." But he's welcome to study it, and even
copy anything in it he wants.
Actually, it's only a three line function if you pass in the string refs.
char plugboard( char Char, std::string const &Values,
std::string const &Characters ){
std::size_t index( Characters.find( Char ) );
if( std::string::npos == index ){ return ' ';}
return Values.at( index );
}
Wouldn't it be more idiomatic to define a Translator functional
object, and let the user use std::transform? (It's certainly
more fashionable. You just aren't "in" unless you can work in
some templates and the standard algorithms:-). Whether it's a
better solution is, of course, a different question.)

--
James Kanze (GABI Software) email:ja*********@gmail.com
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34

Jul 4 '07 #20

James Kanze <ja*********@gmail.comwrote in message...

/* """ Hi James,

On Jul 4, 4:32 am, "BobR" <removeBadB...@worldnet.att.netwrote:
Protoman wrote in message...
B/c I want something simpler than that.
Simpler than a five line character translator? Good luck with that.
Well, character translation per se is usually only one line:
char translated = translationMap[ original ] ;
:-).
""" */

Hah! Where is your check for the validity of 'original'? <G>

/* """
The real question, however, is: why a 36 character encoder? Why
not 256 (or more correctly, UCHAR_MAX+1)?
""" */

Did you see the original post 'plugboard()'? Would you want to maintain 256
of those? :-}

/* """
For the rest, there's a complete implementation of encode/decode
using a Enigma machine at my site
(http://kanze.james.neuf.fr/code-en.html, the executable
"crypt"). From the man page for it: "Isn't really useful for
anything. It's not secure enough for real encryption, and is a
lot more complicated than a simple rot13 for the cases where it
would be sufficient." But he's welcome to study it, and even
copy anything in it he wants.
Actually, it's only a three line function if you pass in the string refs.
char plugboard( char Char, std::string const &Values,
std::string const &Characters ){
std::size_t index( Characters.find( Char ) );
if( std::string::npos == index ){ return ' ';}
return Values.at( index );
}
Wouldn't it be more idiomatic to define a Translator functional
object, and let the user use std::transform? (It's certainly
more fashionable. You just aren't "in" unless you can work in
some templates and the standard algorithms:-). Whether it's a
better solution is, of course, a different question.)
""" */

I agree.
Not sure if Protoman is doing homework, self-study or just a personal
project. Don't want to get too far ahead of the task (learning).
( hint: (s)he keeps using char arrays instead of std::string, std::vector,
etc.).

--
Bob R
POVrookie
Jul 4 '07 #21
On 4 Jul, 09:41, "BobR" <removeBadB...@worldnet.att.netwrote:
James Kanze <james.ka...@gmail.comwrote in message...

/* """ Hi James,

On Jul 4, 4:32 am, "BobR" <removeBadB...@worldnet.att.netwrote:
Protoman wrote in message...
B/c I want something simpler than that.
Simpler than a five line character translator? Good luck with that.

Well, character translation per se is usually only one line:
char translated = translationMap[ original ] ;
:-).
""" */

Hah! Where is your check for the validity of 'original'? <G>

/* """
The real question, however, is: why a 36 character encoder? Why
not 256 (or more correctly, UCHAR_MAX+1)?
""" */

Did you see the original post 'plugboard()'? Would you want to maintain 256
of those? :-}

/* """
For the rest, there's a complete implementation of encode/decode
using a Enigma machine at my site
(http://kanze.james.neuf.fr/code-en.html, the executable
"crypt"). From the man page for it: "Isn't really useful for
anything. It's not secure enough for real encryption, and is a
lot more complicated than a simple rot13 for the cases where it
would be sufficient." But he's welcome to study it, and even
copy anything in it he wants.
Actually, it's only a three line function if you pass in the string refs.
char plugboard( char Char, std::string const &Values,
std::string const &Characters ){
std::size_t index( Characters.find( Char ) );
if( std::string::npos == index ){ return ' ';}
return Values.at( index );
}

Wouldn't it be more idiomatic to define a Translator functional
object, and let the user use std::transform? (It's certainly
more fashionable. You just aren't "in" unless you can work in
some templates and the standard algorithms:-). Whether it's a
better solution is, of course, a different question.)
""" */

I agree.
Not sure if Protoman is doing homework, self-study or just a personal
project. Don't want to get too far ahead of the task (learning).
( hint: (s)he keeps using char arrays instead of std::string, std::vector,
etc.).

--
Bob R
POVrookie
It's a personal project.

Jul 4 '07 #22
On 4 Jul, 10:54, Protoman <Protoman2...@gmail.comwrote:
On 4 Jul, 09:41, "BobR" <removeBadB...@worldnet.att.netwrote:


James Kanze <james.ka...@gmail.comwrote in message...
/* """ Hi James,
On Jul 4, 4:32 am, "BobR" <removeBadB...@worldnet.att.netwrote:
Protoman wrote in message...
B/c I want something simpler than that.
Simpler than a five line character translator? Good luck with that.
Well, character translation per se is usually only one line:
char translated = translationMap[ original ] ;
:-).
""" */
Hah! Where is your check for the validity of 'original'? <G>
/* """
The real question, however, is: why a 36 character encoder? Why
not 256 (or more correctly, UCHAR_MAX+1)?
""" */
Did you see the original post 'plugboard()'? Would you want to maintain 256
of those? :-}
/* """
For the rest, there's a complete implementation of encode/decode
using a Enigma machine at my site
(http://kanze.james.neuf.fr/code-en.html, the executable
"crypt"). From the man page for it: "Isn't really useful for
anything. It's not secure enough for real encryption, and is a
lot more complicated than a simple rot13 for the cases where it
would be sufficient." But he's welcome to study it, and even
copy anything in it he wants.
Actually, it's only a three line function if you pass in the string refs.
char plugboard( char Char, std::string const &Values,
std::string const &Characters ){
std::size_t index( Characters.find( Char ) );
if( std::string::npos == index ){ return ' ';}
return Values.at( index );
}
Wouldn't it be more idiomatic to define a Translator functional
object, and let the user use std::transform? (It's certainly
more fashionable. You just aren't "in" unless you can work in
some templates and the standard algorithms:-). Whether it's a
better solution is, of course, a different question.)
""" */
I agree.
Not sure if Protoman is doing homework, self-study or just a personal
project. Don't want to get too far ahead of the task (learning).
( hint: (s)he keeps using char arrays instead of std::string, std::vector,
etc.).
--
Bob R
POVrookie

It's a personal project.- Hide quoted text -

- Show quoted text -
OK, I'm just going to return to my massive if...else block for now.
Now, when I did that, it encrypts, but it doesn't decrypt:

Rotor settings: QWERTYUIOP
Cleartext: DELTA
Ciphertext: PSS66

Rotor settings: QWERTYUIP
Ciphertext: PSS66
Cleartext: M7B1H

What do you think went wrong?

Jul 4 '07 #23

Protoman <Pr**********@gmail.comwrote in message...
OK, I'm just going to return to my massive if...else block for now.
Now, when I did that, it encrypts, but it doesn't decrypt:

Rotor settings: QWERTYUIOP
Cleartext: DELTA
Ciphertext: PSS66

Rotor settings: QWERTYUIP
Ciphertext: PSS66
Cleartext: M7B1H

What do you think went wrong?
Don't know. I'd suggest the debugger, BUT, you'd be there for days/weeks
trying to find the bug. Maybe put a few 'cout' in the code to trace where it
goes wrong.

We'd need to see your current code to tell ( and it seems to big to post
here).

If using your original post code, double check that these two lines are
intact:

else if(Char=='J') return 'O';
// ....
else if(Char=='O') return 'J';

--
Bob R
POVrookie
Jul 4 '07 #24
Protoman wrote:
OK, I'm just going to return to my massive if...else block for now.
Now, when I did that, it encrypts, but it doesn't decrypt:

Rotor settings: QWERTYUIOP
Cleartext: DELTA
Ciphertext: PSS66

Rotor settings: QWERTYUIP
Ciphertext: PSS66
Cleartext: M7B1H

What do you think went wrong?
Are the two settings supposed to be the same?
Rotor settings: QWERTYUIOP
Rotor settings: QWERTYUIP
There's an 'O' in the first.

--
Thomas
http://www.netmeister.org/news/learn2quote.html
Jul 4 '07 #25
On 4 Jul, 15:42, "BobR" <removeBadB...@worldnet.att.netwrote:
Protoman <Protoman2...@gmail.comwrote in message...
OK, I'm just going to return to my massive if...else block for now.
Now, when I did that, it encrypts, but it doesn't decrypt:
Rotor settings: QWERTYUIOP
Cleartext: DELTA
Ciphertext: PSS66
Rotor settings: QWERTYUIP
Ciphertext: PSS66
Cleartext: M7B1H
What do you think went wrong?

Don't know. I'd suggest the debugger, BUT, you'd be there for days/weeks
trying to find the bug. Maybe put a few 'cout' in the code to trace where it
goes wrong.

We'd need to see your current code to tell ( and it seems to big to post
here).

If using your original post code, double check that these two lines are
intact:

else if(Char=='J') return 'O';
// ....
else if(Char=='O') return 'J';

--
Bob R
POVrookie
Yeah, they are, and I'm usig my original code. So I don't know.

Jul 5 '07 #26
On 4 Jul, 15:56, "Thomas J. Gritzan" <Phygon_ANTIS...@gmx.dewrote:
Protoman wrote:
OK, I'm just going to return to my massive if...else block for now.
Now, when I did that, it encrypts, but it doesn't decrypt:
Rotor settings: QWERTYUIOP
Cleartext: DELTA
Ciphertext: PSS66
Rotor settings: QWERTYUIP
Ciphertext: PSS66
Cleartext: M7B1H
What do you think went wrong?

Are the two settings supposed to be the same?
Rotor settings: QWERTYUIOP
Rotor settings: QWERTYUIP

There's an 'O' in the first.

--
Thomashttp://www.netmeister.org/news/learn2quote.html
That was a typing error when I posted. I don't think that's the
problem.

Jul 5 '07 #27

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

Similar topics

2
by: Duncan | last post by:
I am using the evaluation version of CE.NET 4.1. I had also installed the release version of the Compact Framework. I uninstalled the CE.NET 4.1, and then realized I needed it again and...
4
by: David Moss | last post by:
I was given a Compaq pocket PC with windows mobile 2002. I immediately began looking into how to program it and Java seemed initially to be a good choice. To my surprise I found it wasn't as...
7
by: Doug Vogel | last post by:
Hi All - I have a client for whom I developed an Access 2000 database. The database is split into 2 files - front-end (forms, queries, reports), and back-end (tables). An .mde file has been...
96
by: Karen Hill | last post by:
SELECT surgeries.*, animals.* FROM surgeries INNER JOIN animals ON .=. AND WHERE ((.=Date()) Or .=Date()); I'm trying to write a query that joins two table together, animals and surgeries...
4
by: Adam Clauss | last post by:
OK, lets say I have a C# Windows application. In it is a a series of namespaces, all rooted for a certain namespace A. For ex, the "using" directives would read something like: using A; using...
4
by: robinsand | last post by:
Header File: car.h #if !defined CAR_H #define CAR_H enum TCarType { ctEconomy = 1, ctCompact, ctStandard, ctFullSize, ctMiniVan, ctSUV }; class Car { public: Car();
14
by: Charles Jenkins | last post by:
I want to make a MenuItem that I can 'click' programmatically. I started by coding this: class ClickableMenuItem : MenuItem { public void DoClick( EventArgs e ) { OnClick( e ); } ...
3
by: G Gerard | last post by:
Hello The more I use an application ( an mdb) created using MSAccess I notice that the Byte size of the application keeps on increasing. Once in a while I do a Compact and Repair Database...
9
by: Ecohouse | last post by:
I have a main form with two subforms. The first subform has the child link to the main form identity key. subform1 - Master Field: SK Child Field: TrainingMasterSK The second subform has a...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.