Results 1 to 6 of 6

Thread: cryptography

  1. #1
    Junior Member
    Join Date
    May 2002
    Posts
    15

    cryptography

    How can encrypt document(Ms-Word) or other files except ascii text files using VC++?If we have the ascii value we could manipulate files but how can we do for a word document? I tried with my own alg. but i couldn't open even the plain text in word document?

    Could anyone give me a clue of how i can do it?

    Chokks

  2. #2
    Junior Member
    Join Date
    May 2002
    Posts
    25
    Im not sure how you could get a word file to work...
    You could always just save as ASCII with line break, even if you're in Word. However, there is probably a way to do it for regular Word files. I'll try to figure it out.

  3. #3
    Junior Member
    Join Date
    May 2002
    Posts
    15
    Thanks for your reply.I could get out ASCII for word files if saved in ascii format but for non-ascii files how can we encrypt.If you come across any idea or logic of doing share with me.
    Chokks.

  4. #4
    Senior Member
    Join Date
    Dec 2001
    Posts
    134
    If you're simply making your own algorythm in c++, open the file in a binary mode, take the integer value of each character when you read them in 1 at a time, then do your work on the data. the file itself will be complete giberish and won't open with formatting in word if you encrypt the file as a whole, not just the text inside it, it will open as an ascii text file and just display everything in it. But most encryption programs don't intend to make the file exactly the same as the original, unless you have the method to decrypt it then you shouldn't be worrying about it anyways.
    Reality is the one who has it wrong, not you

  5. #5
    Senior Member
    Join Date
    Jul 2001
    Posts
    143
    I suggest you take a look at Microsoft's CryptoAPI:

    http://discuss.microsoft.com/archives/cryptoapi.html

    Google has some additional links, but you'll find using a Cryptographic Service Provider is much easier than programming your own cryptography methods and functions (I know, I had to do RSA encryption for my Data Structures and Algorithms class).

    Regards,
    Wizeman
    \"It\'s only arrogrance if you can\'t back it up, otherwise it is confidence.\" - Me

  6. #6
    Shadow Programmer mmelby's Avatar
    Join Date
    Jul 2002
    Location
    Ft. Myers, FL
    Posts
    291
    Using PGP or Blowfish there are both standalone and DLL versions that will encrypt binary or ACSII files. Using any search engine should get you what you need.
    Work... Some days it's just not worth chewing through the restraints...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •