Results 1 to 12 of 12

Thread: How to make a Cypher [Encrypting & Decrypting String]

  1. #1

    Thread Starter
    Addicted Member Reapism's Avatar
    Join Date
    Sep 2012
    Posts
    170

    Question How to make a Cypher [Encrypting & Decrypting String]

    I would like to know how to make a relatively basic Cypher using a basic algorithm. I have tried many times but fail miserably.

    I am very sorry I cannot provide you with a basis of code for you to work of with but hopefully a detailed explanation might do it.

    Features of the Cypher.

    • Ability to Encrypt & Decrypt String data.
    • Ability to customize a password in order to make it harder to decrypt.
    • In order to decrypt the recipient must have the password the first user encrypted with.


    Here's the trick, Once lets say I encrypt the string "Hello World" and then the encrypted data turns into "47mcsDwej#E3@%#@" and then when I encrypt "Hello World" with the same password again, a new encryption will show up as well as it being able to decrypt itself! So same message that can be of multiple encryptions.
    Last edited by Reapism; Jul 6th, 2013 at 07:55 AM. Reason: Added a feature

  2. #2
    Frenzied Member IanRyder's Avatar
    Join Date
    Jan 2013
    Location
    Healing, UK
    Posts
    1,232

    Re: How to make a Cypher [Encrypting & Decrypting String]

    Hi,

    There are various encryption techniques available for you to use so as a starting point having a look here:-

    http://msdn.microsoft.com/en-us/libr...code-snippet-1

    Hope that helps,

    Cheers,

    Ian

  3. #3
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: How to make a Cypher [Encrypting & Decrypting String]

    So, you want us to do your homework for you? Probably not going to happen, or shouldn't at least. First things first, what's your algorithm? You don't need any programming experience to create that because it's just a series of steps and someone should be able to follow them with a pen and paper. Without an algorithm, you don't know what your code actually has to do so it should be no surprise that you can't write the code to do it. Start with the broad strokes and then break each step up into smaller steps and keep doing that until you have everything as simple as it can go. Only when you can follow those steps with a pen and paper and get the correct result should you even consider writing any code. You don't need us for that, unless you try to follow the steps and don't get the correct result, in which case you should post your algorithm and we can help you fix it for yourself.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  4. #4
    PowerPoster dunfiddlin's Avatar
    Join Date
    Jun 2012
    Posts
    8,245

    Re: How to make a Cypher [Encrypting & Decrypting String]

    then when I encrypt "Hello World" with the same password again, a new encryption will show up as well as it being able to decrypt itself!
    Well, if you can pull that off you may well be getting an email from the Pentagon! Just how exactly would the password held by the recipient be able to unlock two different encryptions, assuming that it's not a trial and error algorithm .. stop when you come up with a word that's in the dictionary!
    As the 6-dimensional mathematics professor said to the brain surgeon, "It ain't Rocket Science!"

    Reviews: "dunfiddlin likes his DataTables" - jmcilhinney

    Please be aware that whilst I will read private messages (one day!) I am unlikely to reply to anything that does not contain offers of cash, fame or marriage!

  5. #5
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,413

    Re: How to make a Cypher [Encrypting & Decrypting String]


  6. #6

    Thread Starter
    Addicted Member Reapism's Avatar
    Join Date
    Sep 2012
    Posts
    170

    Angry Re: How to make a Cypher [Encrypting & Decrypting String]

    Quote Originally Posted by jmcilhinney View Post
    So, you want us to do your homework for you? Probably not going to happen, or shouldn't at least. First things first, what's your algorithm? You don't need any programming experience to create that because it's just a series of steps and someone should be able to follow them with a pen and paper. Without an algorithm, you don't know what your code actually has to do so it should be no surprise that you can't write the code to do it. Start with the broad strokes and then break each step up into smaller steps and keep doing that until you have everything as simple as it can go. Only when you can follow those steps with a pen and paper and get the correct result should you even consider writing any code. You don't need us for that, unless you try to follow the steps and don't get the correct result, in which case you should post your algorithm and we can help you fix it for yourself.
    Hey, why don't I just do that. It looks like I posted a topic for a reason. I have not asked anyone to do any sort of homework, I don't know where your assumption comes from however, to write the algorithm is challenging in itself. I am trying to declare the alphabet and somehow take the the letters and add and subtract the char value, maybe that will work, I don't know its difficult to try to write a algorithm if you don't know the basis. Please, all I ask is a bit of help but in all honesty, Please don't assume I am asking for homework, I would commission it if I was...

  7. #7

    Thread Starter
    Addicted Member Reapism's Avatar
    Join Date
    Sep 2012
    Posts
    170

    Re: How to make a Cypher [Encrypting & Decrypting String]

    Quote Originally Posted by IanRyder View Post
    Hi,

    There are various encryption techniques available for you to use so as a starting point having a look here:-

    http://msdn.microsoft.com/en-us/libr...code-snippet-1

    Hope that helps,

    Cheers,

    Ian
    I will have a look thanks Ian. I just am really excited to make this.

  8. #8

    Thread Starter
    Addicted Member Reapism's Avatar
    Join Date
    Sep 2012
    Posts
    170

    Re: How to make a Cypher [Encrypting & Decrypting String]

    Actually, you would be very suprised. I do have a program that does it but I obviously don't have the source, just the application. I believe he is using some sort of randomization.

  9. #9
    PowerPoster dunfiddlin's Avatar
    Join Date
    Jun 2012
    Posts
    8,245

    Re: How to make a Cypher [Encrypting & Decrypting String]

    Quote Originally Posted by Reapism View Post
    Actually, you would be very suprised. I do have a program that does it but I obviously don't have the source, just the application. I believe he is using some sort of randomization.
    I would indeed. Especially if it was using randomization. The only way to do it without double locking (a system in which coder and reader are entirely ignorant of each other's passwords allowing for random second keys to be applied but requiring the message to pass between the sender and the receiver several times) would be to have something within the encrypted version which reveals the encryption method but that would be both non-standard and potentially self defeating since clearly it could not itself be encrypted and therefore would be extractable without the need of a password.

    There are algorithms which are relatively secure requiring no passwords and which would contain their own decoding methods but the trouble with those are that they remain secure only until the secret is discovered at which point all messages will be readable. I devised one many years ago and I've always wanted to set breaking it as a contest somewhere to see just how sturdy it would be but I have no doubt that someone would crack it eventually even in its most sophisticated form. But then that's probably true of pretty much all encryption methods even today. With enough time and computing power all codes are potentially breakable.

    As for algorithms, just look up codes on t'Internet. From the Caesar (Rot-13) to Playfair (a favourite of the kind of cryptic crossword setter who really like to make me suffer!) there are dozens of examples available. Anything you can do on paper you can just as easily do in code (er ... VB code, not the other kind, obviously!)
    Last edited by dunfiddlin; Jul 7th, 2013 at 12:38 PM.
    As the 6-dimensional mathematics professor said to the brain surgeon, "It ain't Rocket Science!"

    Reviews: "dunfiddlin likes his DataTables" - jmcilhinney

    Please be aware that whilst I will read private messages (one day!) I am unlikely to reply to anything that does not contain offers of cash, fame or marriage!

  10. #10
    PowerPoster Evil_Giraffe's Avatar
    Join Date
    Aug 2002
    Location
    Suffolk, UK
    Posts
    2,555

    Re: How to make a Cypher [Encrypting & Decrypting String]

    Quote Originally Posted by dunfiddlin View Post
    I would indeed. Especially if it was using randomization. The only way to do it without double locking (a system in which coder and reader are entirely ignorant of each other's passwords allowing for random second keys to be applied but requiring the message to pass between the sender and the receiver several times) would be to have something within the encrypted version which reveals the encryption method but that would be both non-standard and potentially self defeating since clearly it could not itself be encrypted and therefore would be extractable without the need of a password.
    I imagine it is something akin to salting passwords before hashing them. The idea being to be able to encrypt the same message twice, but not be able to tell from the ciphertexts that the plaintexts are the same. The message would clearly need to be a combination of the output of the cipher and the salt - in the same way that you store the salt and the hash of a password - and it would need some careful cryptographic analysis to ensure that there wasn't a way of computing whether two messages were identical even without decrypting (i.e. an attacker wouldn't know the content of the messages, but would know that they're the same).

  11. #11
    PowerPoster Evil_Giraffe's Avatar
    Join Date
    Aug 2002
    Location
    Suffolk, UK
    Posts
    2,555

    Re: How to make a Cypher [Encrypting & Decrypting String]

    Quote Originally Posted by Reapism View Post
    • Ability to Encrypt & Decrypt String data.
    Nowadays, encryption algorithms generally work on bytes, not characters. (Quick, what's the result of ROT13'ing the string 'é'?) You probably (read: definitely) do not want to have your encryption take responsibility for encoding the string data into bytes.

    Quote Originally Posted by Reapism View Post
    • In order to decrypt the recipient must have the password the first user encrypted with.
    If you're doing a search, be aware that this is called 'Symmetric Encryption'. There is also something called 'Asymmetric Encryption' where to decrypt you need a different key to that used to encrypt (obviously, the two keys are mathematically related).

  12. #12
    PowerPoster Evil_Giraffe's Avatar
    Join Date
    Aug 2002
    Location
    Suffolk, UK
    Posts
    2,555

    Re: How to make a Cypher [Encrypting & Decrypting String]

    Quote Originally Posted by dunfiddlin View Post
    There are algorithms which are relatively secure requiring no passwords and which would contain their own decoding methods but the trouble with those are that they remain secure only until the secret is discovered at which point all messages will be readable. I devised one many years ago and I've always wanted to set breaking it as a contest somewhere to see just how sturdy it would be but I have no doubt that someone would crack it eventually even in its most sophisticated form. But then that's probably true of pretty much all encryption methods even today. With enough time and computing power all codes are potentially breakable.
    That's not how cryptographers use the term 'secure'. An attacker is assumed to have perfect knowledge of the encryption algorithm.

Tags for this Thread

Posting Permissions

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



Click Here to Expand Forum to Full Width