Thread: What's wrong with my Stream Cipher Encryption?

  1. #1

    Lightbulb What's wrong with my Stream Cipher Encryption?

    Encryption seems to be hot topic at the moment and I could do with some advice on my own algorithm (but I'm not looking for someone to debug my code).

    Below you will find a link to my random number generator C++ class. The random number generator algorithm is a good one -- I developed it from a standard algorithm (references are supplied in the download) and have tested it substantially. I thought that this would make the basis for a good symmetic encryption algorithm, therefore I extended the internal seed used by the algorithm from 32 bits to 64 bits (using the __int64 type), and added encrypt and decrypt data methods. After doing a little research recently, I now know that what I have is often referred to as a 'Symmetric Stream Cipher'.

    Download size : 11KB
    Randomal64.cpp/h are writted in standard C++ (but use the extended __int64 type)
    Source for a demo program is included, but this is Borland C++ Builder
    Instructions are included & the source is free of copyright (see readme.txt)

    I'd really like to use my algorithm in a commercial product and publish the source widely, but I'm skeptical about it's security. Here's my question:

    My encryption algorithm would seem to be very good -- it's very simple and very quick. And (on the surface) would appear to be very secure. In fact it's so simple, it should have been obvious along time ago. So why isn't there a well known algorithm similiar to mine in use already? From what I've gathered, Stream Ciphers are really used, instead most symmetric encryption algorithms are known as 'block ciphers' and are more complicated.

    So what's wrong with my algorithm? Is it the case that stream ciphers are susceptible to an analytical attack? My only inclination goes along the lines of:

    1. Pseudo random number generators are deterministic (hence not truely random). I know for a fact that it is possible by analysis to distinguish between a sequence of truely random numbers (say generated by physical effects) and those generated by a deterministic algorithm.

    2. Therefore, given some clues as to what the encrypted data contains, it may be possible to analytically predict the behaviour of my algorithm, without knowledge of the internal key 64 bit key value. Hence, hack the data.

    But I don't know. Can anyone shed any light on this?


  2. #2
    >From what I've gathered, Stream Ciphers are really used

    Sorry, that should read:

    From what I've gathered, Stream Ciphers are rarely used

  3. #3

    hey hey

    ummm you would really need soeone who knows about encryption and not c++ but I believe that I could answer your question, symmetric cyphers are not used in general i dont know about yours specifically, this is because for many many years people have been able to produce unbreakable cyphers, the problem lies with key ditribution, the key must be known to decrypt the message and so you would have to deliver it in person. The encryption people use now is RSA which is an asymmetric cypher which solves the problem of key distribution, and so basically you no longer need to encrypt messages with a normal cypher

    now maybe you can answer me a question how do you store really big numbers in c++ like hundreds of digits long, please email me instead of posting thanx.

    any questions comments
    reach me at
    ps if your good at c++ i have more questions

  4. #4
    Hey - thanks for the reply.

    Yeh, when many people think of encryption they thinking of public/private key (asymmetric) encryption.

    There's nothing wrong with symmetric encryption, provided the fact you are using the same key to encrypt and decrypt is not a problem in the process. Password protected files would fall into this catagory.

    Will email you regarding your question.


Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 16
    Last Post: 11-23-2007, 01:48 PM
  2. help needed with edit control & encryption
    By willc0de4food in forum Windows Programming
    Replies: 2
    Last Post: 03-16-2006, 08:21 PM
  3. Help! About text stream and binary stream
    By Antigloss in forum C Programming
    Replies: 1
    Last Post: 09-01-2005, 08:40 AM
  4. Buffering??
    By Brain Cell in forum C Programming
    Replies: 15
    Last Post: 09-21-2004, 06:57 AM
  5. Replies: 9
    Last Post: 07-01-2002, 07:50 AM