Quick quester

This is a discussion on Quick quester within the C++ Programming forums, part of the General Programming Boards category; Hey, how would you assess the dificulty in writing an bitwiseshift decryption program is C++? Moderate? Easy? Difficult? It would ...

  1. #1
    Registered User
    Join Date
    Apr 2004
    Posts
    7

    Quick quester

    Hey, how would you assess the dificulty in writing an bitwiseshift decryption program is C++? Moderate? Easy? Difficult? It would have to decrypt at a specified shift place (like three left).

    Also, is it possible to write one in any type of scripting language (aka javascript)?

    Thanks.
    -Wynter

  2. #2
    Registered User
    Join Date
    Nov 2001
    Posts
    1,348
    Definitely. One you get the algorithm down mathematically, the coding is simple.

    Kuphryn

  3. #3
    Hardware Engineer
    Join Date
    Sep 2001
    Posts
    1,398

    It's not hard if you know a couple of things...

    You need to know about file I/O, and bit-shifting. There is some good information about bit shifting in the Programming FAQ.

    Something keep in-mind: Bit-shifting throws-away bits. If you shift-left 3 bits, you loose the 3 leftmost bits. This should NOT be a problem with most 16-bit or 32 bit operating systems, assuming that you are encrypting/decrypting ASCII, which only uses 8-bits. You may need to use typecasting or some other tricks to get your data into a type with enough extra bits. Good programming practice would require you to use sizeof() or <limits> to make sure that you never loose any data.

    If you want to do bit-rotation, and put those "lost" leftmost bits into the "new" rightmost bits, you'll have to write the code yourself using the other bitwise operators.

    I don't know java script, but I sort-of suspect it's too "high-level" to have any bit manipulation instructions. You could do bit-shifting by multiplying and dividing by two (or multiples of two).
    Last edited by DougDbug; 06-02-2004 at 01:34 PM.

  4. #4
    Registered User
    Join Date
    Apr 2004
    Posts
    7
    Okay, thanks. That's really helpful. I need to write one to decrypt a file from a challenge site and I think it's a bitwise shift, or rotation. IE: 100110 shifted 2 left would be 011010. I appriciate the help though I think that I'll need some specific questions answered when I get down to coding it.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. strcmp returning 1...
    By Axel in forum C Programming
    Replies: 12
    Last Post: 09-08-2006, 08:48 PM
  2. Do you know...
    By davejigsaw in forum C++ Programming
    Replies: 1
    Last Post: 05-10-2005, 11:33 AM
  3. Questions on basic Quick Sort
    By Weng in forum C++ Programming
    Replies: 4
    Last Post: 12-16-2003, 10:06 AM
  4. Quick Sort Help
    By NavyBlue in forum C Programming
    Replies: 1
    Last Post: 03-02-2003, 10:34 PM
  5. Replies: 0
    Last Post: 04-30-2002, 08:24 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21