Article View: sci.crypt
Article #3172Re: Encryption using C++
From: Steve E. Chapel
Date: Mon, 28 Aug 1995 07:00
Date: Mon, 28 Aug 1995 07:00
29 lines
1988 bytes
1988 bytes
ihabed@uncc.edu (Ibrahim H Abed) writes: >I was wondering does encryption with C++ offer some advantages/dis- >advantages over C? Would the object-oriented approach to programming >in C++ help in some of the complicated operations involved in encryption >methods such as DES and other complicated schemes? I used a template matrix class in a program to break Hill encipherment. Breaking the code is equivalent to multiplying the ciphertext by the inverse of the plaintext to get the key, and enciphering is equivalent to multiplying the plaintext by the key to get the ciphertext. In C++, I performed these operations with the * and / operators in my matrix class, and the matrix class was instantiated using a modulus class that performed modulo n arithmetic. Thus in my program, breaking the code and encrypting and decrypting were one statement; I saw one of my classmates' C programs, and it looked horrendus, with things like an array named "temp" in the deciphering process. C++ lends itself to a cleaner design. With an arbitrary length integer class, RSA becomes very easy; you would use the overloaded pow function in the class to perform encryption and decryption. In C the code would be messier at best, and at worst you would either have to write all your own code or rewrite old code; in C++ you can reuse the same old code unchanged. -- Steve Chapel schapel@cs.ucsb.edu | http://www.cs.ucsb.edu/~schapel Senior in Computer Science at the | finger -l schapel@eci1.ucsb.edu University of California, Santa Barbara | PGP key on the way...
Technical Details
Message-ID:
<41rphk$i2j@zonker.cs.ucsb.edu>Path:
arc1-ca.pugleaf.net!nntp.ucsb.edu!not-for-mailReferences:
<41i8s0$oeb@news.uncc.edu>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!nntp.ucsb.edu!not-for-mail From: schapel@zonker.cs.ucsb.edu (Steve E. Chapel) Newsgroups: sci.crypt,comp.lang.c++ Subject: Re: Encryption using C++ Date: 28 Aug 1995 00:00:04 -0700 Organization: University of California, Santa Barbara Message-ID: <41rphk$i2j@zonker.cs.ucsb.edu> References: <41i8s0$oeb@news.uncc.edu> NNTP-Posting-Host: zonker.cs.ucsb.edu