Wednesday, February 26, 2014
Play Fair Cipher (C++ code)
#include<iostream>
#include <string>
using namespace std;
class playfair
{
public:
void doIt( string k, string t, bool ij, bool e )
{
createGrid( k, ij ); getTextReady( t, ij, e );
if( e ) doIt( 1 ); else doIt( -1 );
display();
}
private:
void doIt( int dir )
{
int a, b, c, d; string ntxt;
for( string::const_iterator ti = _txt.begin(); ti != _txt.end(); ti++ )
{
if( getCharPos( *ti++, a, b ) )
if( getCharPos( *ti, c, d ) )
{
if( a == c ) { ntxt += getChar( a, b + dir ); ntxt += getChar( c, d + dir ); }
else if( b == d ){ ntxt += getChar( a + dir, b ); ntxt += getChar( c + dir, d ); }
else { ntxt += getChar( c, b ); ntxt += getChar( a, d ); }
}
}
_txt = ntxt;
}
void display()
{
cout << "\n\n OUTPUT:\n=========" << endl;
string::iterator si = _txt.begin(); int cnt = 0;
while( si != _txt.end() )
{
cout << *si; si++; cout << *si << " "; si++;
if( ++cnt >= 26 ) cout << endl, cnt = 0;
}
cout << endl << endl;
}
char getChar( int a, int b )
{
return _m[ (b + 5) % 5 ][ (a + 5) % 5 ];
}
bool getCharPos( char l, int &a, int &b )
{
for( int y = 0; y < 5; y++ )
for( int x = 0; x < 5; x++ )
if( _m[y][x] == l )
{ a = x; b = y; return true; }
return false;
}
void getTextReady( string t, bool ij, bool e )
{
for( string::iterator si = t.begin(); si != t.end(); si++ )
{
*si = toupper( *si ); if( *si < 65 || *si > 90 ) continue;
if( *si == 'J' && ij ) *si = 'I';
else if( *si == 'Q' && !ij ) continue;
_txt += *si;
}
if( e )
{
string ntxt = ""; size_t len = _txt.length();
for( size_t x = 0; x < len; x += 2 )
{
ntxt += _txt[x];
if( x + 1 < len )
{
if( _txt[x] == _txt[x + 1] ) ntxt += 'X';
ntxt += _txt[x + 1];
}
}
_txt = ntxt;
}
if( _txt.length() & 1 ) _txt += 'X';
}
void createGrid( string k, bool ij )
{
if( k.length() < 1 ) k = "KEYWORD";
k += "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; string nk = "";
for( string::iterator si = k.begin(); si != k.end(); si++ )
{
*si = toupper( *si ); if( *si < 65 || *si > 90 ) continue;
if( ( *si == 'J' && ij ) || ( *si == 'Q' && !ij ) )continue;
if( nk.find( *si ) == -1 ) nk += *si;
}
copy( nk.begin(), nk.end(), &_m[0][0] );
}
string _txt; char _m[5][5];
};
int main( int argc, char* argv[] )
{
string key, i, txt; bool ij, e;
cout << "(E)ncode or (D)ecode? "; getline( cin, i ); e = ( i[0] == 'e' || i[0] == 'E' );
cout << "Enter a en/decryption key: "; getline( cin, key );
cout << "I <-> J (Y/N): "; getline( cin, i ); ij = ( i[0] == 'y' || i[0] == 'Y' );
cout << "Enter the text: "; getline( cin, txt );
playfair pf; pf.doIt( key, txt, ij, e ); return system( "pause" );
}
E-Governance Paper Review
Review of the Paper
ENABLING
e-GOVERNANCE
INTREGRATED CITIZEN
RELATIONSHIP MANAGEMENT FRAMEWORK
-THE INDIAN PERSPECTIVE
Introduction:
The paper describes some of the
best practices that have emerged during the course of the many implementation
of e11, a customizable multiannual e-Governance and CRM solution, in India. The
focus was how an e-Governance system can be successfully implemented and used. It’s
based on the research being carried out at SHTR Consulting Group (SCG) with
purpose to develop a framework through which effective an efficient
e-Governance can be done.
At root e-Governance provides
automation, informatisation and transformation which gives governance this is
cheaper, does more, quicker, works better and innovative.
Indian Aspect:
Legislation in India, a country
with 1.2 billion population spread over 28 geographically uneven states with
different languages, literacy level and culture, is very challenging. According
to Sharma (2002), the culture of governance in India characterized by secrecy,
seniority and corruption which poses great challenges in implementation of
e-governance. In human level, the change processes have to be properly
understood, accepted, internalized, adopted and improved to achieve the full advantage.
Govt. of India issued guideline that 2-3% of every ministry or department plan
budget was to utilize in achieving e-Governance using IT (Raje, 1999). Due to
lack of coordination duplicate technical task has been implemented in different
department.
E-Gov. Framework (eeGF)
To effective answer the challenges
SCG developed eeGF which proposed an integrated approach towards knowledge
management, information gathering, information dissemination, citizen request
management.
The core components of eeGF are:
Portal/Content Management System: created on project basis with
standard content management engine. Layout and design are are reworked to
reflect the specific requirements of the customer. One can choose between different services and
create portal or portents in matter of few days. Master Content Management
Engine can generate innumerable portals. Portals provides role based,
personalized access to information, services and functions.
‘Life events’ capture the reason of
people visiting portals and portal offer help on life event in three level
-
Check listing all life event and enumerating all the
actions to think about and all there is to know
-
Instructions for critical activities and suggestion how
to conduct and what to be careful.
-
Show relevant electronic services
Citizen Request Management:
The main components are
-
Request assignment and routing
-
Request escalation
-
Response tracker
-
Response reporter
-
Time management tools
-
Contact management
Self Help: some examples are
-
Integrated view of various account
-
Retrieving information offerings
-
Web form services
-
Registration for events
-
Information are on the law and how its interpreted
-
Simulation of tax calculation
One to One chat and Messaging: citizen service tool for website and
organization wide internal communication. It features text chat, push pages,
real time traffic monitoring, pull, workflow manager, answer book, messaging,
chat transcript, visitor profile analysis, migrate.
Knowledge Management
Answer Book and Documents Management
Benefits:
eeGL provides increased
availability, faster processing with fewer errors . It exploits all the modern
customer relationship management including process reengineering, efficiency, collaboration
and communities.
Conclusion:
The eeGIF makes it possible for any
government organization to work step-by-step toward web based administration
and to build on its current software application gradually until it has its
own comprehensive integrated e-Governance
solution
Subscribe to:
Posts (Atom)