Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. How To Create My Own File Encryption Algorithm

How To Create My Own File Encryption Algorithm

Scheduled Pinned Locked Moved C#
algorithmssecurityhelptutorialquestion
8 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Sokka93
    wrote on last edited by
    #1

    Hello. I've created a text encryption algorithm and it works fine. The problem is I don't know how to encrype a file. Can anyone tell me how to do that? I don't want any code just some tips. Thanks in advance.

    M P L 3 Replies Last reply
    0
    • S Sokka93

      Hello. I've created a text encryption algorithm and it works fine. The problem is I don't know how to encrype a file. Can anyone tell me how to do that? I don't want any code just some tips. Thanks in advance.

      M Offline
      M Offline
      Manas Bhardwaj
      wrote on last edited by
      #2

      1.) Read the file into a byte[] and convert into base64 string. 2.) Encrypt the text using algo and write it back.

      Manas Bhardwaj Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.

      1 Reply Last reply
      0
      • S Sokka93

        Hello. I've created a text encryption algorithm and it works fine. The problem is I don't know how to encrype a file. Can anyone tell me how to do that? I don't want any code just some tips. Thanks in advance.

        P Offline
        P Offline
        Paladin2000
        wrote on last edited by
        #3

        Use this article: Simple encrypting and decrypting data in C#[^]

        1 Reply Last reply
        0
        • S Sokka93

          Hello. I've created a text encryption algorithm and it works fine. The problem is I don't know how to encrype a file. Can anyone tell me how to do that? I don't want any code just some tips. Thanks in advance.

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          Sokka93 wrote:

          I've created a text encryption algorithm and it works fine.

          Would you like us to take a look at that? It's very easy to make mistakes with that.. By the way, why did you make a new one? It's usually much safer to use a public algorithm that has been extensively analyzed..

          S 1 Reply Last reply
          0
          • L Lost User

            Sokka93 wrote:

            I've created a text encryption algorithm and it works fine.

            Would you like us to take a look at that? It's very easy to make mistakes with that.. By the way, why did you make a new one? It's usually much safer to use a public algorithm that has been extensively analyzed..

            S Offline
            S Offline
            Sokka93
            wrote on last edited by
            #5

            Because I'm going to use it to enroll a competition. All I'll do is to create a random encryption algorithm. It works with text but the problem is I create the key and I can't think any way of giving the key to someone. Because the key is random too. So I decided to use it to encrypte files.

            L 1 Reply Last reply
            0
            • S Sokka93

              Because I'm going to use it to enroll a competition. All I'll do is to create a random encryption algorithm. It works with text but the problem is I create the key and I can't think any way of giving the key to someone. Because the key is random too. So I decided to use it to encrypte files.

              L Offline
              L Offline
              Lost User
              wrote on last edited by
              #6

              Are there any restrictions on the format of your key or is it just a number? If it's just a number, you could use Diffie-Hellman key exchange right (so your key won't be leaked in any way)

              S 1 Reply Last reply
              0
              • L Lost User

                Are there any restrictions on the format of your key or is it just a number? If it's just a number, you could use Diffie-Hellman key exchange right (so your key won't be leaked in any way)

                S Offline
                S Offline
                Sokka93
                wrote on last edited by
                #7

                No not just numbers. Letters and numbers. BTW Is it a problem for a key to be long? Are there any restrictions about it? Because the key can be so long. My algorith decides Its length according to the lenght of the text. So the key might be so long. I plan to put the text into a cube and turn it according to random numbers. Like The Cube Of Rubik. ANd I'm thinking of saving all the moves and create a key with it.

                L 1 Reply Last reply
                0
                • S Sokka93

                  No not just numbers. Letters and numbers. BTW Is it a problem for a key to be long? Are there any restrictions about it? Because the key can be so long. My algorith decides Its length according to the lenght of the text. So the key might be so long. I plan to put the text into a cube and turn it according to random numbers. Like The Cube Of Rubik. ANd I'm thinking of saving all the moves and create a key with it.

                  L Offline
                  L Offline
                  Lost User
                  wrote on last edited by
                  #8

                  note: I apologize in advance for any errors I may make. Letters are numbers too of course, but I meant that if your key has a specific format then you have to do an extra step to compress your key to raw binary (and you have to be able to reverse that operation from any binary string), otherwise the result of the DH-exchange is "not a key" For DH-exchange the key can be arbitrarily long, but when it's several KB's long it becomes somewhat slow (prohibitively slow for 10KB+)

                  1 Reply Last reply
                  0
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  • Login

                  • Don't have an account? Register

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • World
                  • Users
                  • Groups